Beispiel #1
0
        ///
        override protected bool IsOffscreenCore()
        {
            IsOffscreenBehavior behavior = AutomationProperties.GetIsOffscreenBehavior(_owner);

            switch (behavior)
            {
            case IsOffscreenBehavior.Onscreen:
                return(false);

            case IsOffscreenBehavior.Offscreen:
                return(true);

            case IsOffscreenBehavior.FromClip:
            {
                bool isOffscreen = !_owner.IsVisible;

                if (!isOffscreen)
                {
                    UIElement containingUIElement = GetContainingUIElement(_owner);
                    if (containingUIElement != null)
                    {
                        Rect boundingRect = UIElementAutomationPeer.CalculateVisibleBoundingRect(containingUIElement);

                        isOffscreen = (DoubleUtil.AreClose(boundingRect, Rect.Empty) ||
                                       DoubleUtil.AreClose(boundingRect.Height, 0) ||
                                       DoubleUtil.AreClose(boundingRect.Width, 0));
                    }
                }

                return(isOffscreen);
            }

            default:
                return(!_owner.IsVisible);
            }
        }