Project Description
Easy to use Silverlight based Validator toolkit for validating user input. Also includes input filtering and formatting options.

This toolkit provides the following:
  • Required Field Validator
  • Field Length Validator
  • Phone Validator (and optional formatting)
  • SSN Validator
  • Regex Validator
  • Numeric Range Validator
  • Text input filter service is included that can be used to filter user input to only numerics, alphas, etc.
  • Easily modified to add additional validator types

It is very easy to add new validators and customize. Currently only designed for use with the built in TextBox control but could be modified to validate any type of control. The Silverlight.Validators.dll is a meager 24kb.

Live Demo: http://www.vinsolutions.com/validatordemotestpage.aspx



Implementation is similar to using the TooltipService

Here is a sample of the XAML needed for the validators to implement them. A manager is used to keep track of all of the validators on your UserControl. You can have multiple groups if needed and you can check the ValidatorManager to see if all the controls are valid within the group (similar to Page.IsValid).

<slv:ValidatorManager x:Name="Group1"></slv:ValidatorManager>

<TextBox x:Name="_Field1">
<slv:ValidatorService.Validator>
<slv:RequiredValidator ManagerName="Group1"/>
</slv:ValidatorService.Validator>
</TextBox>

Known issues:
If being used in a Grid and that Grid is the LayoutRoot there are some limitations to how the indicators may show up. If you place that Grid in another Grid then it works better.

So why did create this? As we started making simple data entry forms in Silverlight we figured out there was no validation solution available anywhere... so we decided we to make our own and share it!

This project was created and released by Jeff Wolfer and Matt Watson from VinSolutions, a developer of Automotive Software.
The included TextBoxFilterService was borrowed from Manish Dalal http://weblogs.asp.net/manishdalal

Last edited Nov 22, 2008 at 2:33 PM by spo81rty, version 9