MaskedTextInput Reg Ex UpperCase issue

2 posts, 0 answers
  1. Karthik
    Karthik avatar
    1 posts
    Member since:
    Sep 2012

    Posted 06 Sep 2012 Link to this post

    I have following xaml in my project 
    telerik:RadMaskedTextInput Margin="15"                                     Mask=">a13"                                     EmptyContent="Enter rfc"                                     Value="{Binding Path=TestString,Mode=TwoWay, ValidatesOnNotifyDataErrors=True, ValidatesOnExceptions=true, NotifyOnValidationError=True}"/> and following property in viewmodel
     private string _testString = "";
            public string TestString
                get { return _testString; }
                    _testString = value;
    What i am trying to do is enforce uppercase(">") with length of 13
    Issue is, when started typing in above box ,text was all lower case until i entered a valid text("TTTT000000TTT")
     then it changes to upper case
    If i take out "[RegularExpression(@"^([A-Z]{4})\d{6}([A-Z\w]{3})$")]" , above from my property, and start typing 
    it is all uppercase like i want, But i do want to use my reg ex

    Am i missing something here ?


  2. Petar Mladenov
    Petar Mladenov avatar
    2991 posts

    Posted 11 Sep 2012 Link to this post

    Hi Karthik,

    Please find attached a project with latest official telerik assemblies where you can take advantage of the AllowInvalidValues property and set it to true. This way the setter of the property will fire and you will be able to validate your property with the Validator.ValidateProperty method. Actually this is how the Validation should be performed when it comes up to DataAnnotation Attributes (RegularExpression is part of them). This will be reflected in our documentation till the end of this week.
    Hope this is suitable for you. 

    All the best,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top