Skip to content

DataGridTemplateColumn shows red border for row level validation errors #9513

Answered by miloush
eugenelepekhin asked this question in Q&A
Discussion options

You must be logged in to vote

Right, you need to be distinguishing between errors of the cell and errors of the buttons. If there is no binding on the button, it has no errors, but the cell still does. You can see that easier if you give it some space:

<DataGrid ItemsSource="{Binding Path=Items}" AutoGenerateColumns="False" RowHeaderWidth="30">
    <DataGrid.Resources>
        <!--<Style TargetType="{x:Type ContentPresenter}">
            <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
        </Style>-->
    </DataGrid.Resources>
    <DataGrid.RowValidationErrorTemplate>
        <ControlTemplate>
            <Grid DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type D…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@miloush
Comment options

miloush Aug 2, 2024
Collaborator

Comment options

You must be logged in to vote
1 reply
@miloush
Comment options

miloush Aug 2, 2024
Collaborator

Comment options

You must be logged in to vote
2 replies
@miloush
Comment options

miloush Aug 3, 2024
Collaborator

Answer selected by eugenelepekhin
@eugenelepekhin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants