コード例 #1
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)
                   ));
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
ファイル: Extensions.cs プロジェクト: dfr0/moon
        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)
                );
        }