FocusManager.GetFocusedElement Method (DependencyObject)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the element with focus within the specified focus scope.

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


Public Shared Function GetFocusedElement ( _
    element As DependencyObject _
) As Object
public static Object GetFocusedElement(
    DependencyObject element


Return Value

Type: System.Object
The element in the specified focus scope that has current focus.


Exception Condition

element cannot be null


Generally there is only a single focus scope in a Silverlight application. However, modal dialogs and popups can introduce additional focus scopes, in which case using the overload that enables specifying the scoping object might be necessary.

In the current implementation, passing an element parameter value that is not of type Window will result in a returned value of null.

Version Information


Supported in: 5


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.