I’m facing the following problem: I’m using validation summary popup for displaying errors on the page, and i have an editable DataGrid. So there are 2 problems:
1) DataGrid validation duplicates validation error, if it occurs in the DataGrid cell. For example. DataGrid contains a collection of objects IEnumerable. When I’m doing ComplexObject.Validate() for each object in collection, i get 1 validation error for each incorrect object in the DataGrid footer and 2 same errors in my Validation Summary popup. I tried with another Datagrid (Telerik) and it worked just fine, so i assume it’s DataGrid’s problem, though Telerik control doesn’t suit me.
2) DataGrid validation foot is redundant, and i want to remove/hide it.
Is there any way to achieve both options at the same time? Thanks in advance.
To remove the datagrid validation summary (question #2), extract the style using blend or reflector, stick it in a Style resource dict, and remove the validation summary control.
Then reference the style in the datagrid declaration (Style={StaticResource DataGridOverrideStyle}). Here’s the xaml for silverlight 4 if you don’t have reflector or blend: