Get open Popups

 public  IEnumerable<Popup> GetOpenPopups()
        {
            return PresentationSource.CurrentSources.OfType<HwndSource>()
                .Select(h => h.RootVisual)
                .OfType<FrameworkElement>()
                .Select(f => f.Parent)
                .OfType<Popup>()
                .Where(p => p.IsOpen);
        }

 

posted @ 2015-09-09 14:42  法的空间  阅读(235)  评论(0编辑  收藏  举报