internal static bool Within(this Point referencePoint, UIElement referenceElement, FrameworkElement targetElement, bool ignoreVertical)
        {
            Point position = referenceElement.Translate(targetElement, referencePoint);

            return(position.X > 0 && position.X < targetElement.ActualWidth &&
                   (ignoreVertical ||
                    (position.Y > 0 && position.Y < targetElement.ActualHeight)
                   ));
        }
        private void EnsureChildClip(UIElement child, double frozenLeftEdge)
        {
            double childLeftEdge = child.Translate(this, new Point(0, 0)).X;

            if (frozenLeftEdge > childLeftEdge)
            {
                double            xClip = Math.Round(frozenLeftEdge - childLeftEdge);
                RectangleGeometry rg    = new RectangleGeometry();
                rg.Rect    = new Rect(xClip, 0, Math.Max(0, child.RenderSize.Width - xClip), child.RenderSize.Height);
                child.Clip = rg;
            }
            else
            {
                child.Clip = null;
            }
        }
Exemple #3
0
        internal static bool Within(this Point referencePoint, UIElement referenceElement, FrameworkElement targetElement, bool ignoreVertical)
        {
            Point position = referenceElement.Translate(targetElement, referencePoint);

            return position.X > 0 && position.X < targetElement.ActualWidth
                && (ignoreVertical
                    || (position.Y > 0 && position.Y < targetElement.ActualHeight)
                );
        }