Beispiel #1
0
 /// <summary>
 /// Invoked when unhandled MouseWheel event reaches this element. This method is called before the MouseWheel event is fired.
 /// </summary>
 /// <param name="e">The event arguments for the event.</param>
 /// <remarks>This base implementation is empty.</remarks>
 protected virtual void OnMouseWheel(MouseWheelEventArgs e)
 { }
Beispiel #2
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);
    }
Beispiel #3
0
 private static void OnMouseWheelThunk(object sender, MouseWheelEventArgs e)
 {
   var uiElement = sender as UIElement;
   if (uiElement != null)
   {
     uiElement.OnMouseWheel(e);
   }
 }
Beispiel #4
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

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

      int numLines = e.NumDetents * scrollByLines;

      if (numLines < 0)
        MoveDown(-1 * numLines);
      else if (numLines > 0)
        MoveUp(numLines);
    }