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="$-$"