예제 #1
0
        private static object OnCoerceVisible(DependencyObject d, object newValue)
        {
            Viewport2D viewport   = (Viewport2D)d;
            DataRect   newVisible = (DataRect)newValue;

            DataRect newRect = viewport.CoerceVisible(newVisible);

            if (viewport.FromContentBounds && viewport.prevVisibles.ContainsValue(newRect))
            {
                return(DependencyProperty.UnsetValue);
            }
            else
            {
                viewport.prevVisibles.AddValue(newRect);
            }

            if (newRect.Width == 0 || newRect.Height == 0)
            {
                // doesn't apply rects with zero square
                return(DependencyProperty.UnsetValue);
            }
            else
            {
                return(newRect);
            }
        }
예제 #2
0
        private static object OnCoerceVisible(DependencyObject d, object newValue)
        {
            Viewport2D viewport = (Viewport2D)d;

            Rect newRect = viewport.CoerceVisible((Rect)newValue);

            if (newRect.Width == 0 || newRect.Height == 0)
            {
                // doesn't apply rects with zero square
                return(DependencyProperty.UnsetValue);
            }
            else
            {
                return(newRect);
            }
        }