Approved
Last Updated: 27 Dec 2016 13:44 by ADMIN
ADMIN
Petar Mladenov
Created on: 17 Sep 2014 14:18
Category: MaskedInput
Type: Bug Report
1
MaskedInput: Incorrect coerce of Value when Mask is "a-a" ("a/a", "LL/LL") and Value is set to "m-m".
Mask is "a-a". Value is set to "M-M".

The MaskedTextInput control must internally coerce the Value to "MM".
Instead , MaskedTextInput'Value is "M-" which is wrong.

Other example of the same issue:
Bound Value is bbaabbaabbdd, Mask is "aa-aa-aa-aa-aa-aa"
The result is - value becomes bbbbbbddaaaa.

Workaround:
Use custom Mask Token (check help article: http://docs.telerik.com/devtools/wpf/controls/radmaskedinput/how-to/howto-create-custom-token.html)

 public class CustomToken : ITokenValidationRule
    {
        public bool IsRequired
        {
            get { return false; }
        }

        public bool IsValid(char ch)
        {
            return ValidChars.Contains(ch.ToString());
        }

        public char Token
        {
            get { return '$'; }
        }

        public TokenTypes Type
        {
            get { return TokenTypes.AlphaNumeric; }
        }

        private string myValidChars = "0123456789qwertyuioplkjhgfdsazxcvbnm";
        public string ValidChars
        {
            get { return myValidChars; }
        }
    }

    TokenLocator.AddCustomValidationRule(new CustomToken());
            InitializeComponent();

   <telerik:RadMaskedTextInput Mask="$-$"  
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments