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); } }
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); } } }
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); } }
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(); } }
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(); } }
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); } }
bool OnUp() { IScrollViewerFocusSupport svfs = FindScrollControl() as IScrollViewerFocusSupport; return(svfs != null && svfs.FocusUp()); }
public bool EndScroll() { IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport; return(svfs != null && svfs.EndScroll()); }
public bool Scroll(float deltaX, float deltaY) { IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport; return(svfs != null && svfs.Scroll(deltaX, deltaY)); }
public bool ScrollUp(int numLines) { IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport; return(svfs != null && svfs.ScrollUp(numLines)); }
public bool FocusPageRight() { IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport; return(svfs != null && svfs.FocusPageRight()); }
public bool BeginScroll() { IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport; return svfs != null && svfs.BeginScroll(); }
public bool FocusLeft() { IScrollViewerFocusSupport svfs = _itemsHostPanel as IScrollViewerFocusSupport; return svfs != null && svfs.FocusLeft(); }