I have a RadMaskedTextInput Box that I have validated in the backend as follows.
//Phone Number[RegularExpression(@"^\d{10}$")]public string PhoneNumber{ get { return _phoneNumber; } set { double.TryParse(value, out temp); if (_phoneNumber != value) { Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "PhoneNumber" }); _phoneNumber = value; OnPropertyChanged("PhoneNumber"); } }}The xaml for the object is as follows:
<!-- Phone Number --><telerik:RadMaskedTextInput Margin="2" BorderBrush="LightGray" IsClearButtonVisible="False" Mask="(###) ###-####" UpdateValueEvent="PropertyChanged" TextMode="PlainText" Value="{Binding Path=PhoneNumber, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True, UpdateSourceTrigger=PropertyChanged}">This does not have the expected behavior.
What I want is that when the user does not have a valid 10 digit phone number then set the validation flag that the number is incorrect.
While it may be left blank, as soon as they start typing I want it to show a red box until only 10 digits are present.
