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
960
Select all text on activate
posted

Is it possible to set the XamInput (masked or numeric) to have the content selected when activated?

I've tried using the activate or focus event but the result is ugly especially on the numeric input.

Parents
  • 34430
    Offline posted

    Hello Sabrina,

    To have everything selected on activation of the XamMaskedInput or XamNumericInput, I would recommend handling the Loaded and PreviewMouseUp events on each of these controls. Each event handler can be the same code, where you cast the sender to the corresponding input control, and call SelectAll() on it. You will also want to set the SelectAllBehavior of the two controls to SelectEnteredCharacters. The reason the Loaded event is necessary here is because the input controls will remember that the content in them is selected, so when you tab into them or between them, the content will be selected.

    I am unsure what you are referring to by the result being "ugly" on the inputs. I am under the impression that you may mean the long line that shows up before the number in the numeric input, and after the content of the masked one. This can be removed by setting the PromptChar property on each of them to " ".

    I have attached a sample application to demonstrate the above.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

    XamInputsSelectAllCase.zip
Reply Children
No Data