Пример #1
0
        public override void OnTouchMove(TouchMoveEvent touchEventArgs)
        {
            base.OnTouchMove(touchEventArgs);
            if (!touchEventArgs.IsPrimaryContact)
            {
                return;
            }

            if (_lastTouchEvent != null)
            {
                // Transform screen (i.e. 720p) to skin coordinates (i.e. 1080p)
                float lastX = _lastTouchEvent.LocationX;
                float lastY = _lastTouchEvent.LocationY;
                float currX = touchEventArgs.LocationX;
                float currY = touchEventArgs.LocationY;
                if (!TransformMouseCoordinates(ref lastX, ref lastY) || !TransformMouseCoordinates(ref currX, ref currY))
                {
                    return;
                }

                var scrollX = currX - lastX;
                var scrollY = currY - lastY;

                IScrollViewerFocusSupport svfs = FindScrollControl() as IScrollViewerFocusSupport;
                if (svfs == null)
                {
                    return;
                }

                svfs.Scroll(scrollX, scrollY);
            }
        }
Пример #2
0
        public override void OnMouseWheel(int numDetents)
        {
            base.OnMouseWheel(numDetents);

            if (!IsMouseOver)
            {
                return;
            }

            int numLines = numDetents * SystemInformation.MouseWheelScrollLines;

            if (numLines < 0)
            {
                IScrollViewerFocusSupport svfs = FindScrollControl() as IScrollViewerFocusSupport;
                if (svfs != null)
                {
                    svfs.ScrollDown(-1 * numLines);
                }
            }
            else if (numLines > 0)
            {
                IScrollViewerFocusSupport svfs = FindScrollControl() as IScrollViewerFocusSupport;
                if (svfs != null)
                {
                    svfs.ScrollUp(numLines);
                }
            }
        }
Пример #3
0
        protected override void OnMouseWheel(MouseWheelEventArgs e)
        {
            // migration from OnMouseWheel(int numDetents)
            // - no need to check if mouse is over
            // - no need to call base class

            IScrollViewerFocusSupport svfs = FindScrollControl() as IScrollViewerFocusSupport;

            if (svfs == null)
            {
                return;
            }

            int scrollByLines = SystemInformation.MouseWheelScrollLines; // Use the system setting as default.

            IScrollInfo scrollInfo = svfs as IScrollInfo;

            if (scrollInfo != null && scrollInfo.NumberOfVisibleLines != 0) // If ScrollControl can shown less items, use this as limit.
            {
                scrollByLines = scrollInfo.NumberOfVisibleLines;
            }

            int numLines = e.NumDetents * scrollByLines;

            if (numLines < 0)
            {
                svfs.ScrollDown(-1 * numLines);
            }
            else if (numLines > 0)
            {
                svfs.ScrollUp(numLines);
            }
        }
Пример #4
0
        public override void OnTouchUp(TouchUpEvent touchEventArgs)
        {
            base.OnTouchUp(touchEventArgs);
            if (!touchEventArgs.IsPrimaryContact)
            {
                return;
            }

            _lastTouchEvent = null;
            IScrollViewerFocusSupport svfs = FindScrollControl() as IScrollViewerFocusSupport;

            if (svfs != null)
            {
                svfs.EndScroll();
            }
        }
Пример #5
0
        public override void OnTouchDown(TouchDownEvent touchEventArgs)
        {
            var isInArea = IsInArea(touchEventArgs.LocationX, touchEventArgs.LocationY);

            base.OnTouchDown(touchEventArgs);
            // Only start handling touch if it happened inside control's area
            if (!touchEventArgs.IsPrimaryContact || !isInArea)
            {
                return;
            }

            _lastTouchEvent = touchEventArgs;
            IScrollViewerFocusSupport svfs = FindScrollControl() as IScrollViewerFocusSupport;

            if (svfs != null)
            {
                svfs.BeginScroll();
            }
        }
Пример #6
0
        public override void OnMouseWheel(int numDetents)
        {
            base.OnMouseWheel(numDetents);

            if (!IsMouseOver)
            {
                return;
            }

            IScrollViewerFocusSupport svfs = FindScrollControl() as IScrollViewerFocusSupport;

            if (svfs == null)
            {
                return;
            }

            int scrollByLines = SystemInformation.MouseWheelScrollLines; // Use the system setting as default.

            IScrollInfo scrollInfo = svfs as IScrollInfo;

            if (scrollInfo != null && scrollInfo.NumberOfVisibleLines != 0) // If ScrollControl can shown less items, use this as limit.
            {
                scrollByLines = scrollInfo.NumberOfVisibleLines;
            }

            int numLines = numDetents * scrollByLines;

            if (numLines < 0)
            {
                svfs.ScrollDown(-1 * numLines);
            }
            else if (numLines > 0)
            {
                svfs.ScrollUp(numLines);
            }
        }
Пример #7
0
        bool OnUp()
        {
            IScrollViewerFocusSupport svfs = FindScrollControl() as IScrollViewerFocusSupport;

            return(svfs != null && svfs.FocusUp());
        }
Пример #8
0
        public bool EndScroll()
        {
            IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport;

            return(svfs != null && svfs.EndScroll());
        }
Пример #9
0
        public bool Scroll(float deltaX, float deltaY)
        {
            IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport;

            return(svfs != null && svfs.Scroll(deltaX, deltaY));
        }
Пример #10
0
        public bool ScrollUp(int numLines)
        {
            IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport;

            return(svfs != null && svfs.ScrollUp(numLines));
        }
Пример #11
0
        public bool FocusPageRight()
        {
            IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport;

            return(svfs != null && svfs.FocusPageRight());
        }
Пример #12
0
 public bool BeginScroll()
 {
   IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport;
   return svfs != null && svfs.BeginScroll();
 }
Пример #13
0
 public bool FocusLeft()
 {
   IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport;
   return svfs != null && svfs.FocusLeft();
 }