Reputation: 150
I've been trying to perform some simple validation logic on a column, and so far I have it working with nested tags:
<DataGridTextColumn Header="Property">
<DataGridTextColumn.Binding>
<Binding Path="Property">
<Binding.ValidationRules>
<local:PropertyValidationRule/>
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
But when I try to set the Binding
attribute:
<DataGridTextColumn Header="IPAddress" EditingElementStyle="{StaticResource errorStyle}"
Binding="{Binding Path=Property, ValidationRules={StaticResource validateProperty}}">
I receive an error stating "The property 'ValidationRules' does not have an accessible setter". As far as I'm aware the two methods above are equivalent, but I'm clearly missing something.
Can anybody provide an explanation please?
Upvotes: 0
Views: 36