* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
2.3 KiB
title, description, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | description | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| How to: Position the Cursor at the Beginning or End of Text in a TextBox Control | Learn how to position the cursor at the beginning or end of the text contents of a Windows Presentation Foundation TextBox control. | 03/30/2017 |
|
|
c771a0b8-c6b4-4240-aecd-a21d0ba51a2e |
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 xref:System.Windows.Controls.TextBox control.
Example
The following [!INCLUDETLA#tla_xaml] code describes a xref:System.Windows.Controls.TextBox control and assigns it a Name.
[!code-xamlTextBox_MiscCode#_MoveCursorXAML]
Example
To position the cursor at the beginning of the contents of a xref:System.Windows.Controls.TextBox control, call the xref:System.Windows.Controls.TextBox.Select%2A method and specify the selection start position of 0, and a selection length of 0.
[!code-csharpTextBox_MiscCode#_CursorToStart] [!code-vbTextBox_MiscCode#_CursorToStart]
Example
To position the cursor at the end of the contents of a xref:System.Windows.Controls.TextBox control, call the xref:System.Windows.Controls.TextBox.Select%2A method and specify the selection start position equal to the length of the text content, and a selection length of 0.
[!code-csharpTextBox_MiscCode#_CursorToEnd] [!code-vbTextBox_MiscCode#_CursorToEnd]