Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
173
XamMaskedEditor back space issue
posted

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

????

Parents
No Data
Reply
  • 69686
    Suggested Answer
    posted

    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.

Children