Search code examples
c#xamltextboxwindows-phone

windows phone 8.1 textbox remove dash and select option


I want to remove the flashing dash from a TextBox when the user presses it and to stop the user from being give the option to select and copy text.

Is this possible?


Solution

  • Depending on what you need exactly, there are many ways you can achieve this.

    1. Call Clipboard.SetText("") whenever GotFocus and LostFocus events are triggered.

    2. Override SelectionChanged and do e.Handled = true.

    3. Create your own custom control by inheriting TextBox, set a custom Template, and manually add/remove characters for every KeyDown event.

    There doesn't seem to be a way to change the flashing caret/cursor on Windows Universal apps, and there is no way to disable the clipboard either.