Keyboard.FocusedElement Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the element that has keyboard focus.
public:
static property System::Windows::IInputElement ^ FocusedElement { System::Windows::IInputElement ^ get(); };
public static System.Windows.IInputElement FocusedElement { get; }
static member FocusedElement : System.Windows.IInputElement
Public Shared ReadOnly Property FocusedElement As IInputElement
The focused element.
The following example gets the element with keyboard focus and casts it to a Control. If the element with keyboard focus is a Control, the background of the element is changed.
// Gets the element with keyboard focus.
UIElement elementWithFocus = Keyboard.FocusedElement as UIElement;
' Gets the element with keyboard focus.
Dim elementWithFocus As UIElement = TryCast(Keyboard.FocusedElement, UIElement)
Keyboard focus refers to the object that is receiving keyboard input. The element with keyboard focus has IsKeyboardFocused set to true
. There can be only one element with keyboard focus on the entire desktop. Logical focus refers to the object within a focus scope that has focus. For more information on focus, keyboard focus, and logical focus, see Input Overview and Focus Overview.
An element with keyboard focus also has logical focus for the focus scope the element belongs to. An element with logical focus may or may not have keyboard focus.
Производ | Верзије |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET повратне информације
.NET је пројекат отвореног кода. Изаберите везу да бисте обезбедили повратне информације: