Try the following:
<Style x:Key="CellErrorStyle" TargetType="{x:Type TextBlock}"> <Style.Triggers> <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> <Setter Property="Background" Value="Yellow"/> </Trigger> </Style.Triggers> </Style>
And use it:
<DataGrid.Columns> <DataGridTextColumn ElementStyle="{StaticResource CellErrorStyle}"> </DataGridTextColumn> </DataGrid.Columns>
source share