Gets the instantiated windows in an application.
Assembly: PresentationFramework (in PresentationFramework.dll)
A Window reference is automatically added to as soon as a window is instantiated on the user interface (UI) thread; windows that are created by worker threads are not added. A Window reference is automatically removed after its Closing event has been handled and before its Closed event is raised.
By default, the first item added to the MainWindow.property becomes the
This property is available only from the thread that created the Application object.
The following example demonstrates how to enumerate theproperty to build a top-level Windows menu, which is common to multiple-document interface (MDI) applications like Microsoft Excel, or multiple-instance Single Document Interface (SDI) applications like Microsoft Word.
<Window x:Class="CSharp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="CSharp" Height="300" Width="300" Activated="MainWindow_Activated" > <StackPanel> <Menu> <MenuItem Header="_File"> <MenuItem Name="newWindowMenuItem" Click="newWindowMenuItem_Click" Header="_New Window"></MenuItem> <Separator></Separator> <MenuItem Name="exitMenuItem" Click="exitMenuItem_Click" Header="E_xit"></MenuItem> </MenuItem> <MenuItem Name="windowMenuItem" Header="_Window"> </MenuItem> </Menu> <Canvas></Canvas> </StackPanel> </Window>
Available since 3.0
Available since 5.0