I have a datagrid where I am implementing my own validation checks. When there is an error, I set the row's border to red and display a message to the user what the error is. However, in my datagrid, there is a red exclamation point that shows up as well. I was wondering if there is a way to hide this? I tried checking the Row.HasErrors() but that always returns false and Row.ClearErrors() won't remove the exclamation point either.
2 Answers
Once the datagridrow got an error the exclamation mark does not go away even if you clear the error. In my case i did not need the row error since i am showing errors in the cell itself. So I used DataGrid.RowValidationErrorTemplate to never show the error.
<DataGrid.RowValidationErrorTemplate>
<ControlTemplate>
<TextBlock Text=""></TextBlock>
</ControlTemplate>
</DataGrid.RowValidationErrorTemplate>
Have you checked out How to: Implement Validation with the DataGrid Control?
It depends a bit on exactly where the exclamation point is showing in the DataGrid. For example, if it on the row where the validation occurs you can implement your own DataGrid.RowValidationErrorTemplate or DataGrid.ValidationErrorTemplate.
There are quite a few examples for various situations in the link.