Silverlight Best Practices for Validation?

综合技术 2018-02-10 阅读原文

Is there some best practice or some recommended way how to validate forms in Silverlight? Right now I have to doall validation in endless nested if else structures and it just doesn't seem like a very reusable and maintainable way of doing this.

If I want to show error messages next to each form element I also have to create an empty text block next to each element which will hold the error in case the field is invalid.

I would recommand you the Silverlight toolkit
, which provides easy to use dataform and entity validation mecanisms.

there are samples
describing how to use it, quite a lot of blog posts and a whole (and rather interesting) MSDN magazine article

the dataform is available in the namespace xmlns:dataform="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"

clearly, you need to reference the adequat assemblies in your project (for example System.Windows.Controls.Data.DataForm.Toolkit -pfiou-)

The samples provide code samples, bottom right of the samples browser there is a button which enables code view.

Hello, buddy!

责编内容by:Hello, buddy!阅读原文】。感谢您的支持!


Windows Phone Silverlight 8.1 App Write... With the arrival of Windows Phone 8.1, it is now able to have write access to the SD card of a Windows Phone 8.1 device:...
WindowsPhone 8.1, NavigationBar and Silverlight ap... With Windows Phone 8.1 Microsoft drastically changed on of the basic chassis requirements in Windows Phone since day 0. ...
Silverlight DataGrid Redraw Issue I have a Silverlight DataGrid that contains a single template column which displays a user control. The user control has...
解析Silverlight调用WCF/Rest异常的解决方法... public interface IService1 { string GetData(int value); } 接着新建一个服务实现类: public class Service1 : ISe...
Silverlight WCF activated service with Prism Im required to write a Silverlight application using WCF. I'm also required to use Dependency Injection to gain access...