Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-set-focus-in-a-textbox-control.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* 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
2020-09-04 09:46:28 -07:00

1.6 KiB

title, description, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title description ms.date 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
csharp
vb
focus [WPF], setting
TextBox control [WPF], setting focus
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.

Example

The following [!INCLUDETLA#tla_xaml] example describes a simple xref:System.Windows.Controls.TextBox control named tbFocusMe

[!code-xamlTextBox_MiscCode#_TextBoxFocusXAML]

Example

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]

See also