I have a DataGrid, which is showing some stuff. Each of the cells has a validation on it, using the IDataErrorInfo interface. When the user puts invalid data into the cell, the validation fails and the user is alerted, both by the cell's background turning red, and the error icon appearing to the left of the row. When the user corrects the data, the cell's background goes back to normal, but the error icon doesn't clear. This happens even if I don't define the RowValidationErrorTemplate.
<DataGrid AutoGenerateColumns="False" Height="Auto" HorizontalAlignment="Stretch" Name="dataGrid1" VerticalAlignment="Top" Width="Auto"
ItemsSource="{Binding Path=Records}" ColumnWidth="Auto" CanUserReorderColumns="False"
CanUserResizeColumns="False" SelectionUnit="Cell" CanUserAddRows="True">
<DataGrid.RowValidationRules>
<vm:TimeoutRecordRowValidation ValidationStep="UpdatedValue"/>
</DataGrid.RowValidationRules>
<DataGrid.RowValidationErrorTemplate>
<ControlTemplate>
<Grid ToolTip="{Binding RelativeSource={RelativeSource
FindAncestor, AncestorType={x:Type DataGridRow}},
Path=(Validation.Errors)[0].ErrorContent}">
<Ellipse StrokeThickness="0" Fill="Red"
Width="{TemplateBinding FontSize}"
Height="{TemplateBinding FontSize}" />
<TextBlock Text="!" FontSize="{TemplateBinding FontSize}"
FontWeight="Bold" Foreground="White"
HorizontalAlignment="Center" />
</Grid>
</ControlTemplate>
</DataGrid.RowValidationErrorTemplate>
<DataGrid.Resources>
<Style x:Key="DefaultColumnHeaderStyle" TargetType="DataGridColumnHeader">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=Column.(ToolTipService.ToolTip)}" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="LabelFamilyID
XXX"
Binding="{Binding Path=LabelFamilyID, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
ElementStyle="{StaticResource ErrorStyle}">
</DataGridTextColumn>
<DataGridTextColumn Header="ModelCapacityString
WD????????"
Binding="{Binding Path=ModelCapacityString, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
ElementStyle="{StaticResource ErrorStyle}">
</DataGridTextColumn>
<DataGridTextColumn Header="Timeout Value
99:99:99"
Binding="{Binding Path=TimeoutValue, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
ElementStyle="{StaticResource ErrorStyle}">
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
I have trimmed some of the XAML that is unrelated, like the HeaderStyle definitions, for brevity.