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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.