My Customer Model is as below. Customer Model contains validation attributes
CustomerModel.cs
[IsRequired()]
CustomerID - Int;
[IsRequired()]
CustomerName - String;
CustomerViewModel contains 2 properties as below 1. ObservableCollection of CustomerModel (This is bound Items Source of drop down list) 2. Property returns CustromerModel object as Selected Item (Bound to SelectedItem)
My Question:
How can i provide ValidatesOnDataErrors=true
for combo box?
Do i need to write validation attribute on CustomerModel property inside CustomerViewModel?
Please suggest...
IDataErrorInfo is a type specific implementation of Validation (vs. instance specific). You would be better off using ValidationRules. This link should help on how to implement ValidationRules: http://msdn.microsoft.com/en-us/library/system.windows.data.binding.validationrules.aspx