#306 – Keyboard Focus

In WPF, as in other Windows applications, a control or user interface element has focus if it can receive keyboard input.  Specifically, we say that the control has keyboard focus.

By default, when a WPF application start up, no control has focus.  You can give a control focus by pressing the TAB key–which cycles through all of the controls that are able to receive focus.  You can also give a control focus by clicking on the control.

Not all controls are able to receive focus.  In general, only controls that can accept user input can get focus.

Most controls will give some visual indication that the control currently has keyboard focus.  Many controls will display a dashed line around the control to indicate that it has focus.  The TextBox will display a light blue border to show that it has focus and also contain an editing carat.

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

7 Responses to #306 – Keyboard Focus

  1. Pingback: #307 – Giving Focus to a Control When an Application Starts « 2,000 Things You Should Know About WPF

  2. Pingback: #622 – The Source of a Keyboard Event « 2,000 Things You Should Know About WPF

  3. Pingback: #623 – Focusable Property Indicates Whether a Control Can Receive Focus « 2,000 Things You Should Know About WPF

  4. Pingback: #639 – Default Tab Order Is Sensible « 2,000 Things You Should Know About WPF

  5. Pingback: #973 – Keyboard Shortcuts for a ListBox | 2,000 Things You Should Know About WPF

  6. Pingback: #1,067 – Experimenting with Keyboard Focus | 2,000 Things You Should Know About WPF

  7. Pingback: #1,075 – Triggering on IsKeyboardFocusWithin Property | 2,000 Things You Should Know About WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: