mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
* Metadata updates for US-1889327. * H2 edits. * Updated column header. * Minor edits. * Review edits.
1.6 KiB
1.6 KiB
title, description, ms.date, ms.custom, dev_langs, helpviewer_keywords, ms.assetid
| title | description | ms.date | ms.custom | dev_langs | helpviewer_keywords | ms.assetid | ||||
|---|---|---|---|---|---|---|---|---|---|---|
| How to: Set Focus in a TextBox Control | Learn how to use the Focus method to set focus on a Windows Presentation Foundation TextBox control. | 03/30/2017 | devdivchpfy22 |
|
|
24b61b45-dc2d-425e-9839-b017af7ab86f |
How to: Set Focus in a TextBox Control
This example shows how to use the xref:System.Windows.UIElement.Focus%2A method to set focus on a xref:System.Windows.Controls.TextBox control.
Define a simple TextBox control
The following [!INCLUDETLA#tla_xaml] example describes a simple xref:System.Windows.Controls.TextBox control named tbFocusMe
[!code-xamlTextBox_MiscCode#_TextBoxFocusXAML]
Set the focus on the TextBox control
The following example calls the xref:System.Windows.UIElement.Focus%2A method to set the focus on the xref:System.Windows.Controls.TextBox control with the Name tbFocusMe.
[!code-csharpTextBox_MiscCode#_FocusTextBox] [!code-vbTextBox_MiscCode#_FocusTextBox]