Silverlight Best Practices for Validation?

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!责编内容来自:Hello, buddy! (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 前端开发 » Silverlight Best Practices for Validation?

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录