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
255
Select all text when editing the value
posted

Hi, 

I need to have the hability to select all text in XamNumericInput when user clicks over the control. Right now the focus only is positioned over the character I click on, but I need to select all text to modify its content. Is it possible? I have tried to use SelectAll property, the GotFocus event (and call the SelectAll method), the SelectAllBehavior (="SelectAllCharacters"), but nothing works.

Is there any other approach to use for having this behavior?

Best Regards,

Caludio

Parents
No Data
Reply
  • 5
    Suggested Answer
    posted

    The following works for me in the PreviewMouseLeftButtonDown event as a work around:

    if (num.IsKeyboardFocusWithin) return; // To allow the user to highlight text after the numeric input has focus

    num.Focus();

    num.SelectAll();

    e.Handled = true;

Children
No Data