GetFocusedElement Method
Collapse the table of content
Expand the table of content

FocusManager.GetFocusedElement Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Queries the Windows Phone focus system to determine which object has focus.

Namespace:  System.Windows.Input
Assembly:  System.Windows (in System.Windows.dll)

public static Object GetFocusedElement()

Return Value

Type: System.Object
The object that currently has focus. Typically, this is a Control class.

GetFocusedElement can return null in certain cases. This might happen if there are no true Control class instances anywhere in the Windows Phone UI, or if the hosting browser does not have focus.

Windows Phone focus has the characteristic that while the focus-reporting events GotFocus and LostFocus are raised asynchronously, the focus returned by GetFocusedElement is determined synchronously. This design attempts to loosen constraints on runtime adjustments to element trees that could result from having to wait for the focus to be determined and moved.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft