Export (0) Print
Expand All

Application.MainWindow Property

Gets the out-of-browser application window.

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

public Window MainWindow { get; internal set; }

Property Value

Type: System.Windows.Window
The out-of-browser application window.

ExceptionCondition
UnauthorizedAccessException

The current thread is not the UI thread.

The return value is not meaningful when the application is running within the browser.

You can use this property to programmatically manipulate an out-of-browser application window at run time. The properties of the returned Window instance are initialized from the corresponding WindowSettings properties in the application manifest.

You can set the properties of the Window class only in response to user-initiated actions unless the current application is an elevated trust application. For example, you can change the window size in a button Click event handler.

Silverlight

Supported in: 5, 4

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

Community Additions

ADD
Show:
© 2014 Microsoft