Chapter 26. Validating User Input

,

In This Chapter

Image Property setter validation

Image Understanding binding errors

Image Customizing control visual states in Expression Blend

Image A reusable custom validation component

Image Creating a custom ValidationSummary control

Image Asynchronous and composite validation

Image Setting control-enabled states based on the presence of validation errors

Image Hiding validation errors until the user has had a chance to fill out the form

Image 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.87.83