Data Validation in Silverlight (Method 1)

Here's one way to do validation in silverlight.

This is a pretty straight method using exceptions (if you're from the camp that allows exceptions in your Data objects Cool)



public string Name

     return _name; 
  if ( value.Length >= 10 )
    throw new ArgumentException( "Name is too long" );   
  _name = value;

<TextBox x:Name="name"
   <Binding Path="name"
      ValidatesOnExceptions="True" />  


Comments are closed