Input Validation Using Property Setters

The first validation system discussed in this chapter is the property setter validation system. This system has been with the phone since the first 7.0 release of the Windows Phone SDK and is part of Silverlight 3.

The XAML data-binding system provides validation support when assigning a value to the source of a data-binding expression. For example, when a FrameworkElement (the binding target) has a binding to a property in a viewmodel (the binding source) and the value in the FrameworkElement changes, validation occurs as the value is being assigned to the property in the viewmodel.

To enable property setter validation for an input control, set the binding’s NotifyOnValidationError and ValidatesOnExceptions ...

Get Windows® Phone 8 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.