C validating user input
Save Fillup method instead, as shown in the following code. Save Fillup method accepts a Fillup object to save and an Action delegate for error handling.This method starts by subtracting the previous odometer reading from the current odometer reading and stores the results in the Fillup.The following illustration shows an example of the message that is displayed when the Save button is tapped and the specified odometer reading is less than the previous value.This code simply checks the values of the Fillup properties and returns error strings for any invalid values.Finally, the Save Fillup method returns the Save Result object.Silverlight for Windows Phone provides basic, built-in binding validation through the Binding.Distance Driven property so that validation can occur in the class. Validate method and stores the results in a special Save Result object, which it returns to the caller.
For example, Silverlight provides support for complex validation scenarios. By default, pressing the Back button causes backward navigation.
The following code shows the Save Button_Click event handler in the Fillup Page class.
If values have been entered into each Text Box, an attempt is made to parse the values into values of type float.
To support validation, one option is to re-template the controls to provide your own validation template.
For example, you can customize the desktop version of the template provided in the Text Box Styles and Templates topic.