An important aspect of developing LOB applications is the validation of the data entered by the user. There is no need to say that those validations we are about to see, are client-side. So it will be necessary to validate them again, once the data gets server-side. Remember that, although Silverlight is .NET and a sandbox within our browser, it is exposed to hacking by advanced users. That said, we will see two ways to add validations in Silverlight forms.
Implementing the IDataErrorInfo interface is probably the easiest way to add validation in applications. This interface is not new for Winform developers, as we have had it at our disposal since Framework 1. Nevertheless, from Silverlight 4 onwards, we have been able to make use of it. It is really easy to add validations to our applications thanks to this technique. We will use a new example to see how validations work.
Let us create a new Silverlight application called FormValidation
, where we will ask the user for...