Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
Binding and ValidationRules on fields in XamDataGrid
posted

 Hello all,

The WPF data binding model allows associating ValidationRules with Binding object. 

Into my XamDataGrid, each field has defined a set of ValidationRules

( business rules. These classes are derived from ValidationRule and can make a lot of validation, for example have methods to interrogate a database for process of validation).

My grid is bounded to an IEnumerable property.

How can I reuse my set of validation business rules on each field?

I seen that for a ValueEditor there is a ValueConstraint property, but this is not usefully for me.

There is, also a ValidateCurrentValue method. Can I override this to apply my business rules? And if yes, how can I do this?

If no, someone knows if a field value is bounded, somehow, to a property using Binding object? In this case I can add my validation rules

to  Binding.ValidationRules collection.

I ask this because I see that in XamDataGrid you can add Unbound fields. Have these 2 things something in common?

Can somebody help me?

 

Best Regards, Liviu