MAC
MAC

Reputation: 6577

Validation in Silverlight

how to validate the input form of a silverlight control? I have 3 controls, two out of three are text boxes (For name, and Age), and the remaining one control is date picker.

When i hit submit button, the validation should be invoked. how it will done??

thanks in advance.

Upvotes: 2

Views: 1531

Answers (3)

Grigori Melnik
Grigori Melnik

Reputation: 4107

You may also find the Validation Application Block (which is part of the Enterprise Library Silverlight Integration Pack) useful. It's in public preview right now.

Upvotes: 0

Nikolay R
Nikolay R

Reputation: 957

I wrote my own validaion for SL2. It's based on:

  1. Attached property to give control custom validation ID
  2. Business object validators that identify invalid data
  3. VisualTreeHelper to parse visual tree and match validation result and custom validation ID
  4. Custom templates for controls in order to display validation
  5. INotifyPropertyChanged to remove validation display if property value was changed.

Upvotes: 0

Andy Britcliffe
Andy Britcliffe

Reputation: 769

If you're using Silverlight 3 check out Data Validation. http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx

If you're using Silverlight 2 you'll have to roll your own code for validation.

Upvotes: 2

Related Questions