Tree Helper. Get Open Popups(Window) Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
static IVectorView<Popup> GetOpenPopups(Window const& window);
public static IReadOnlyList<Popup> GetOpenPopups(Window window);
Public Shared Function GetOpenPopups (window As Window) As IReadOnlyList(Of Popup)
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 VisualTreeHelperAPI, or by walking the tree with Child/Items/Children and related properties if you know the exact structure by type.
Submit and view feedback for