Window.GetWindow Method

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

Gets the window that contains the specified DependencyObject.

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

Syntax

'Declaration
Public Shared Function GetWindow ( _
    dependencyObject As DependencyObject _
) As Window
public static Window GetWindow(
    DependencyObject dependencyObject
)

Parameters

Return Value

Type: System.Windows.Window
The Window to get.

Exceptions

Exception Condition
NotSupportedException

The application is not running outside the browser.

InvalidOperationException

dependencyObject is not a valid DependencyObject.

Version Information

Silverlight

Supported in: 5

Platforms

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