I have a DataGrid
with DataGridTextColumn
on which I have a ValidationRule
<DataGridTextColumn Header="xxx" IsReadOnly="False">
<DataGridTextColumn.Binding>
<Binding Path="xxx" >
<Binding.ValidationRules>
<v:xxxValidator />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
I then have b:BindValidationResult.HasError="{Binding HasError}"
on my DataGrid
.
In BindValidationResult
I use Validation.HasErrorProperty
to listen on validationError changed.
My validation rule return return new ValidationResult(false, "");
My feeling is that I don't listen on the right property for a DataGridTextColumn
because if I do the same thing with a TextBox
it works like a charm.
Also, the DataGridCell
get some red border when there is a error so I know that there is something happening.
I even tried this so see if the Validation.HasError
would change but it doesn't trigger.
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter
Property="ToolTip"
Value="{Binding RelativeSource={RelativeSource Self},
Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
Any help will be really appreciated on how to fix this or how to attack the problem.
Thanks