VisualTreeHelper.GetOpenPopups method

Applies to Windows and Windows Phone

Retrieves a collection of all open popup controls from the target Window.


public static IReadOnlyList<Popup> GetOpenPopups(
  Window window



Type: Window

The current Window instance to retrieve the popups from.

Return value

Type: IVectorView<Popup> [C++] | System.Collections.Generic.IReadOnlyList<Popup> [.NET]

The list of all open popups. If no popups are open, the list is empty.


Popups don't exist in the conventional XAML visual tree that begins from the root visual, although they are associated with the app main window. Unless your app maintains a list of all the Popup elements you've created as well as a status (the IsOpen value), it can be difficult to keep track of them. Sometimes you will want to clear all popups prior to initiating another UI action, like navigating the page or displaying a flyout. GetOpenPopups provides the utility so that you can get a reference to all these popups as Popup instances, and then you would typically set IsOpen to false on each of them.

Elements such as AppBar are not considered a popup, they are owned by the Page. A ToolTip is also not considered a popup, it's considered a child of the element that uses the ToolTipService attached properties to host it. Both AppBar and ToolTip elements are thus in the conventional XAML visual tree, even if they're not always displayed at the time. You could find these with GetChild or other VisualTreeHelperAPIs, or by walking the tree with Child/Items/Children and related properties if you know the exact structure by type.


Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml::Media [C++]



See also




© 2014 Microsoft