|
|
Is this possible? I'd like to add a RangeValidator and a RequiredValidator to a text box, if this is possible can you provide an example of how to do so? Thanks.
|
|
Coordinator
Jun 26 2009 at 7:20 PM
|
Yes of course.
You can use the ValidationGroup.
<font size="2">
</font>
ValidationGroup group = new ValidationGroup(
new ValidationItem(new AlnumValidator(false), txtUsername, TextBox.TextProperty),
new ValidationItem(new NotEmptyValidator(), txtUsername, TextBox.TextProperty)
);
<font size="2">
Or simply use the
Silverlight Forms Toolkit.
</font>
formLogin.AddTextBox("username", "Username:", new IValidator[] { new NotEmptyValidator(), new AlnumValidator(false) });
http://silverlightvalidate.codeplex.com/Wiki/View.aspx?title=Examples
|
|
|
|
I tried to add that code to my control but it doesn't recognize ValidationGroup. I looked online and it looks like this is in the System.Web.UI.WebControls namespace which does not appear to be available from the Add Reference menu in VS. What am I overlooking
here? Thanks.
|
|
Coordinator
Jun 26 2009 at 10:28 PM
|
The ValidationGroup class exists in the exsportance.Silverlight.Validate namespace. Here is the class file in source control:
http://silverlightvalidate.codeplex.com/sourcecontrol/changeset/view/19655?projectName=SilverlightValidate#169830
|
|
|
|
fascinating. somehow i downloaded the controls from silverlightvalidator.codeplex.com, and then found this and didn't notice that this was silverlightvalidate.codeplex.com. Very confusing, I wouldn't have guessed there would be two projects with such similar
intent, but thanks for responding to my questions without treating me like a complete idiot :)
|
|