Welcome to Windows Presentation Foundation (WPF)
Top Tasks :

WPF Team Bloggers

Data Validation in 3.5

A cool new feature in the Data area in 3.5 is the support for IDataErrorInfo. Let's take a look at the data validation model in 3.5 by starting with a memory refresher of that in 3.0. We end with a section that discusses how to choose between the different approaches. 3.0 Validation Model In 3.0, you would create a custom ValidationRule or use the built-in ExceptionValidationRule this way: < Binding Source ="{ StaticResource data }" Path ="Age" UpdateSourceTrigger ="PropertyChanged"> < Binding.ValidationRules > < ExceptionValidationRule /> </ Binding.ValidationRules > </ Binding > If the ExceptionValidationRule has been associated with the binding and there’s an exception when the binding engine attempts to set the property on the source, then the binding engine creates a ValidationError with the exception and adds it to the Validation.Errors collection of the bound element. You can use the errors in the collection to provide additional visual feedback (in Read More...
Published Tuesday, October 02, 2007 7:21 PM by Windows Presentation Foundation SDK

Comments

No Comments
Anonymous comments are disabled

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us