I am using XamMaskedEditor for text entry. Setting the Maxlength on the XamMaskedEditor causes one issue which I am not able to resolve.
e.g. when the maxlength is set as 10 and the chars are ABCD, and the user sets focus at the end of the string to update. When the user press back space the D does not get removed. The user need to press back space 7 times to remove the D.
I also tried with value constraint. This too does not resolve the issue.
Setting the PromptChar = '\0' did not help.
MaxLength="10" PromptChar=""
????
Hello,
Well, this is the expected behavior. One way around this is to handle the ExecutingCommand event and see if the current command is Backspace. If it is so, you can move the caret to the last character of the Text, for example:
private void xamMaskedEditor1_ExecutingCommand(object sender, Infragistics.Windows.Controls.Events.ExecutingCommandEventArgs e)
{
if (e.Command == MaskedEditorCommands.Backspace)
xamMaskedEditor1.SelectionStart = xamMaskedEditor1.Text.Length;
e.Handled = true;
}
Hope this helps.
Ok that helps for backspace.
The same behaviour is replicable for Left / Right arrow keys. Any idea for how to handle this?
Thanks for your help.