Silverlight user control validation - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Tuesday, December 6, 2011

Silverlight user control validation

Introduction

This article discusses user control validation techniques in Silverlight. It will help you display validation errors in user controls as they get displayed in textbox, combobox controls.

Problem Definition : 

Very often in programming we require to create our own user controls, which encapsulate system controls as TextBox, ComboBox etc. Silverlight with use of INotifyDataErrorInfo, allows binding source property to throw validation errors which become trickier to display in user controls. 

Attempt for solution :

 One of the simplest solution to overcome this problem is to bind internal system controls of user control to view model properties. But it makes user control tightly coupled to a particular view model, adding unnecessary restriction in control usage. Though, nothing innocuous in doing this (User control aware of view model and its properties), we definitely prefer to have control independent of view model. 

No comments:

Post a Comment