-api-id | -api-type | ms.custom |
---|---|---|
M:Windows.UI.Xaml.Input.FocusManager.GetFocusedElement |
winrt method |
19H1 |
Retrieves the element in the UI that has focus.
The object that has focus. Typically, this is a Control class.
Warning
For WinUI 3 apps, this method always returns null
as it relies on CoreWindow APIs not supported by WinUI 3.
Instead, use the FocusManager.GetFocusedElement(XamlRoot)
overload, where XamlRoot
can be retrieved any loaded UIElement through the XamlRoot property.
GetFocusedElement, Keyboard interactions, Focus navigation for keyboard, gamepad, remote control, and accessibility tools, Programmatic focus navigation