Lezen in het Engels

Share via


FocusManager.GetFocusedElement Method

Definition

Overloads

GetFocusedElement()

Retrieves the element in the UI that has focus.

GetFocusedElement(XamlRoot)

Retrieves the focused element within the Xaml island container.

GetFocusedElement()

Retrieves the element in the UI that has focus.

public static object GetFocusedElement();

Returns

Object

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

Remarks

Waarschuwing

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.

Applies to

WinRT Build 26100 en andere versies
Product Versies
WinRT Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100

GetFocusedElement(XamlRoot)

Retrieves the focused element within the Xaml island container.

[Windows.Foundation.Metadata.Overload("GetFocusedElement")]
public static object GetFocusedElement(XamlRoot xamlRoot);

Parameters

xamlRoot
XamlRoot

Returns

Object

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

Attributes

Windows requirements

Device family
Windows 10, version 1903 (introduced in 10.0.18362.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v8.0)

See also

Applies to

WinRT Build 26100 en andere versies
Product Versies
WinRT Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100