Unplanned
Last Updated: 15 Jun 2017 12:51 by Dinko
ADMIN
Dinko | Tech Support Engineer
Created on: 13 Jun 2017 10:17
Category: MaskedInput
Type: Bug Report
0
MaskedInput: Wrong caret position when InputBehavior property is set to Insert, text is selected and delete key is pressed
You can subscribe to the PreviewKeyDown event of the control. In the event handler, you can double check if all the text is select and if the delete key is pressed. If yes, you can execute the clear command of the control.

private void TxtPhone_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            var myMask = sender as RadMaskedTextInput;
            if (e.Key == Key.Delete && myMask.Text.Length == myMask.SelectionLength)
            {
                myMask.ClearCommand.Execute(null);
            }
        }
2 comments
Dinko
Posted on: 14 Jun 2017 13:08
Indeed the suggested workaround doesn't work in all cases. Another workaround could be setting the InputBehavior to Replace.
Uma
Posted on: 14 Jun 2017 06:54
The above work around will not work for all the cases. If i enter only 3 text but the Length is 8. In this scenario if i execute the SelectAll-> delete for the three characters it will not work.