Beispiel #1
0
 public static bool IsUserVisible(this System.Windows.FrameworkElement element, System.Windows.FrameworkElement container)
 {
     if (!element.IsVisible)
     {
         return(false);
     }
     if (container == null)
     {
         return(true);
     }
     System.Windows.Rect bounds = element.TransformToAncestor(container).TransformBounds(new System.Windows.Rect(0.0, 0.0, element.ActualWidth, element.ActualHeight));
     System.Windows.Rect rect   = new System.Windows.Rect(0.0, 0.0, container.ActualWidth, container.ActualHeight);
     return(rect.Contains(bounds.TopLeft) || rect.Contains(bounds.BottomRight));
 }