In This Chapter
Property setter validation
Understanding binding errors
Customizing control visual states in Expression Blend
A reusable custom validation component
Creating a custom ValidationSummary
control
Asynchronous and composite validation
Setting control-enabled states based on the presence of validation errors
Hiding validation errors until the user has had a chance to fill out the form
Validating a TextBox
as the user types
Input validation is the process of validating input to an application before it is used. Most line-of-business applications rely on input validation to ensure that user input is correctly formatted, meaningful, safe to use, and that it properly conveys the intent of the user.
Input validation in a Windows Phone app may be purely client-side, or it can involve sending input to a web service for validation, which normally entails asynchronous processing.
Windows Phone XAML projects come equipped with support for input validation. There are, however, some crucial validation-related control styles missing from the SDK, which need to be put in place before visual indicators are displayed for validation errors.
This chapter begins by looking at the two types of input validation: syntactic and semantic, and then at the XAML data-binding system as it relates to input validation, its features, and its limitations.
The chapter then provides a walk-through for adding custom control styles for enabling visualization of data validation errors and shows how to create a custom error-validation summary control.
Finally, the chapter explores an alternative approach to validation, one that leverages a more recent set of APIs that allows for asynchronous and composite validation.
3.133.141.219