Validating multiple

If the binding is setup correctly and the view model implements the interface to provide notifications when the data changes, the changes are automatically reflected in the elements in the view that are bound to it.

Besides inheriting and setting the Data Context property on an element directly you can also specify a binding source using the Element Name property, used when you want to bind to some other element, or the Relative Source property.

Setting the property to this value means that the value of the source property only gets updated when you explicitly call the Binding Expression. You will typically never use this approach in an MVVM application though.

If you want to bind a view model property of a specific type to a dependency property in the view of a different type you may need to implement a custom converter class by implementing the interface and setting the Converter property of the binding to an instance of this.

Errors collection when an exception is thrown in the setter of the source property.

For example, it would be useful if the Age property of the view model was constrained to only accept values between 10 and 100 and threw an exception if the value was outside of this range: interface.

Leave a Reply