mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-06 16:06:07 +02:00
* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
21 lines
1.1 KiB
Markdown
21 lines
1.1 KiB
Markdown
---
|
|
title: "How to: Get all Windows in an Application"
|
|
ms.date: "03/30/2017"
|
|
dev_langs:
|
|
- "csharp"
|
|
- "vb"
|
|
helpviewer_keywords:
|
|
- "window objects [WPF], getting"
|
|
ms.assetid: f120f06e-993b-4a97-9657-af0d1986981f
|
|
---
|
|
# How to: Get all Windows in an Application
|
|
This example shows how to get all <xref:System.Windows.Window> objects in an application.
|
|
|
|
## Example
|
|
Every instantiated <xref:System.Windows.Window> object, whether visible or not, is automatically added to a collection of window references that is managed by <xref:System.Windows.Application>, and exposed from <xref:System.Windows.Application.Windows%2A>.
|
|
|
|
You can enumerate <xref:System.Windows.Application.Windows%2A> to get all instantiated windows using the following code:
|
|
|
|
[!code-csharp[HOWTOWindowManagementSnippets#GetAllWindows](~/samples/snippets/csharp/VS_Snippets_Wpf/HOWTOWindowManagementSnippets/CSharp/CustomWindow.xaml.cs#getallwindows)]
|
|
[!code-vb[HOWTOWindowManagementSnippets#GetAllWindows](~/samples/snippets/visualbasic/VS_Snippets_Wpf/HOWTOWindowManagementSnippets/visualbasic/customwindow.xaml.vb#getallwindows)]
|