Hi,
Is there any way to set an e mail mask to the XamMaskedEditor? And a web Site?
Thanks in advance.
Antxon
Hello Antxon,
I was looking into your post and in order to achieve this functionality I can suggest you handle the LostFocus event of the XamNumericEditor and check if the entered value match the email regex pattern like this:
private void XamNumericEditor_LostFocus(object sender, RoutedEventArgs e)
{
string strIn=(sender as XamMaskedEditor).Value.ToString();
(sender as XamMaskedEditor).IsValueValid= Regex.IsMatch(strIn,
@"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))" +
@"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$");
}
You can find this possible approach to set an email regex in the following link from msdn with detailed description of the sintaxis:
http://msdn.microsoft.com/en-us/library/01escwtf(v=vs.95).aspx
Please notice that by setting the property IsVlueValid to false the editor itself will show a red border to indicate the incorrect value.
If you need any additional assistance on the matter, please do not hesitate to ask.
I was just wondering did you have a chance to try my suggestion. If you still need any assistance on the matter, please do not hesitate to ask.
In case the above suggestion helped you solve your issue please verify the thread as answered, so other users may take better advantage of it.
I am not able to reproduce the issue you are describing. Could you please provide me with a small sample, where the described behavior is reproducible.
Hi Elena,
I Checked the new inputs and value constraint class that has a Regular Expresion Field.
The controls Value is bound to a property and is not inside a grid.
Right now I don´t know how to use it in order to check for the previously E mail Regular Expression.
I set the InvalidValueBehaviour to RetainValue, the Value constrain is set to a MaxLenght="200" and the E mail Regular Expression Pattern. Nothign works, the control is not validated when trying to lostfocus, I think that validation is automatic. Is there any Trick? Where can I set the Error Message?
This is the ValueConstrain part of the control.
I was looking into your questions and in order to achieve the desired functionality I can suggest you use the lost focus event of the control and manually check if the entered string suits your requirements. Regarding your specific question about the length of the entered string I can suggest you have a look at our new XamInputs controls where we expose ValueConstraint property that controls the entered string- MinLength and MaxLength, RegexPattern, ets:
http://help.infragistics.com/NetAdvantage/Silverlight/2011.2/CLR4.0/?page=InfragisticsSL4.Controls.Editors.XamMaskedInput.v11.2~Infragistics.Controls.Editors.ValueConstraint_members.html
This will help you set the length of the entered string in a few lines:
<ig:XamMaskedInput>
<ig:XamMaskedInput.ValueConstraint>
<ig:ValueConstraint MinLength="200" MaxLength="200"/>
</ig:XamMaskedInput.ValueConstraint>
</ig:XamMaskedInput>
For further information about the 11.2 XamInputs you can check the following link form our documentation:
http://help.infragistics.com/NetAdvantage/Silverlight/2011.2/CLR4.0/?page=xamInputs_About.html
Please let me know if you need any additional assistance about this.
Thanks for your response. I have been checking the XamMaskedEditor in order to set a Mask and Validation for E-Mail, Web sites, facebook....
Currently is more usefull these electronic data than phone or fax. I hope you will get soon more suitable editors for E-Mails, web sites....
I have been Trying to get the mask for E.Mails. I have 200 length string field bound to the Editors Value.
In the documentation there are some instructions in order to set the mask. Following them I set the mask to a 200 char legth as follows:
Mask="{char:200:a-zA-Z@.}"
but it doesn´t work. It shows some of the mask chars in the editor.
Could you help me in order to set the proper mask for a 200 length char?
How about free text? How can I use the XamMasketEditor?
Thanks in advance