Windows.UI.Xaml.Input.FocusManager.GetFocusedElement

August 14, 2025 ยท View on GitHub

-description

Retrieves the element in the UI that has focus.

-returns

The object that has focus. Typically, this is a Control class.

-remarks

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 from any loaded UIElement through the XamlRoot property.

-examples

-see-also

GetFocusedElement, Keyboard interactions, Focus navigation for keyboard, gamepad, remote control, and accessibility tools, Programmatic focus navigation