简体   繁体   中英

Silverlight Remove Popup Control from Visual Tree

I have a silverlight application, with a control (kind of tooltip) inside a popup, and want to remove this popup in certain case.

In silverlight spy I see that this popup is not a child element of the rootvisual, but appears at the same level.

How can I remove this Popup?

Thanks

OK, So I managed to solve this issue, and it was fairly easy at last.

This is the code I used:

        var popups = VisualTreeHelper.GetOpenPopups();
        foreach (Popup pop in popups)
        {
            if (pop != null && pop.Child is ToolTip)
            {
                ((ToolTip)pop.Child).IsOpen = false;
            }
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM