Export (0) Print
Expand All

Application::Windows Property

Gets the instantiated windows in an application.

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

property WindowCollection^ Windows {
	WindowCollection^ get ();

Property Value

Type: System.Windows::WindowCollection
A WindowCollection that contains references to all window objects in the current AppDomain.

A Window reference is automatically added to Windows 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 Windows property becomes the MainWindow.

This property is available only from the thread that created the Application object.

The following example demonstrates how to enumerate the Windows property 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.

No code example is currently available or this language may not be supported.
<Window x:Class="CSharp.MainWindow"
  Title="CSharp" Height="300" Width="300" Activated="MainWindow_Activated"
      <MenuItem Header="_File">
        <MenuItem Name="newWindowMenuItem" Click="newWindowMenuItem_Click" Header="_New Window"></MenuItem>
        <MenuItem Name="exitMenuItem" Click="exitMenuItem_Click" Header="E_xit"></MenuItem>
      <MenuItem Name="windowMenuItem" Header="_Window">
No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft