Position the Cursor at the Beginning or End of Text in a TextBox Control

How to: Position the Cursor at the Beginning or End of Text in a TextBox Control

 

This example shows how to position the cursor at the beginning or end of the text contents of a TextBox control.

Example

The following Extensible Application Markup Language (XAML) code describes a TextBox control and assigns it a Name.

Example

To position the cursor at the beginning of the contents of a TextBox control, call the Select method and specify the selection start position of 0, and a selection length of 0.

Example

To position the cursor at the end of the contents of a TextBox control, call the Select method and specify the selection start position equal to the length of the text content, and a selection length of 0.

Show:
© 2016 Microsoft