Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
830
E Mail Mask for XamMaskedEditor
posted

Hi,

Is there any way to set an e mail mask to the XamMaskedEditor? And a web Site?

Thanks in advance.

Antxon

Parents
No Data
Reply
  • 17559
    posted

    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.

Children