#306 – Keyboard Focus
May 24, 2011 7 Comments
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.
Pingback: #307 – Giving Focus to a Control When an Application Starts « 2,000 Things You Should Know About WPF
Pingback: #622 – The Source of a Keyboard Event « 2,000 Things You Should Know About WPF
Pingback: #623 – Focusable Property Indicates Whether a Control Can Receive Focus « 2,000 Things You Should Know About WPF
Pingback: #639 – Default Tab Order Is Sensible « 2,000 Things You Should Know About WPF
Pingback: #973 – Keyboard Shortcuts for a ListBox | 2,000 Things You Should Know About WPF
Pingback: #1,067 – Experimenting with Keyboard Focus | 2,000 Things You Should Know About WPF
Pingback: #1,075 – Triggering on IsKeyboardFocusWithin Property | 2,000 Things You Should Know About WPF