void mouseWheelHelper_MouseWheelMoved(object source, MouseWheelEventArgs eventArgs)
        {
            // Ctrl+колесо - масштабирование в IE
            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
            {
                return;
            }
            // Shift+колесо - скроллинг по горизонтали
            if (IsHorizontal)
            {
                if ((Keyboard.Modifiers & ModifierKeys.Shift) != ModifierKeys.Shift)
                {
                    return;
                }
            }
            else
            {
                if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                {
                    return;
                }
            }

            CustomMouseWheelSupport support = source as CustomMouseWheelSupport;

            if (support != null)
            {
                ScrollBar scroller = support.ElementToAddMouseWheelSupportTo as ScrollBar;
                if (scroller != null)
                {
                    var delta = eventArgs.WheelDelta;

                    delta *= ScrollAmount;

                    var newOffset = scroller.Value - delta;

                    if (newOffset > scroller.Maximum)
                    {
                        newOffset = scroller.Maximum;
                    }
                    else if (newOffset < scroller.Minimum)
                    {
                        newOffset = scroller.Minimum;
                    }

                    scroller.Value = newOffset;
                }
            }
            eventArgs.BrowserEventHandled = true;
        }
 public bool RemoveMouseWheelSupport(ScrollBar scrollBar)
 {
     if (mouseWheelHelper != null)
     {
         try
         {
             mouseWheelHelper.RemoveWheelSupport(scrollBar);
             mouseWheelHelper = null;
             return(true);
         }
         catch
         {
             return(false);
         }
     }
     return(false);
 }
 /// <summary>
 /// Adds mouse wheel support to a <see cref="ScrollViewer"/>.
 /// As long as the <see cref="ScrollViewer"/> has focus,
 /// the mouse wheel can be used to scroll up and down.
 /// </summary>
 /// <param name="scrollViewer">The scroll viewer.</param>
 /// <returns>The <see cref="ScrollViewer"/>.</returns>
 public ScrollBar AddMouseWheelSupport(ScrollBar scrollBar)
 {
     mouseWheelHelper = new CustomMouseWheelSupport(scrollBar, null);
     mouseWheelHelper.MouseWheelMoved += new EventHandler <MouseWheelEventArgs>(mouseWheelHelper_MouseWheelMoved);
     return(scrollBar);
 }
 /// <summary>
 /// Adds mouse wheel support to a <see cref="ScrollViewer"/>.
 /// As long as the <see cref="ScrollViewer"/> has focus,
 /// the mouse wheel can be used to scroll up and down.
 /// </summary>
 /// <param name="scrollViewer">The scroll viewer.</param>
 /// <returns>The <see cref="ScrollViewer"/>.</returns>
 public ScrollBar AddMouseWheelSupport(ScrollBar scrollBar)
 {
     mouseWheelHelper = new CustomMouseWheelSupport(scrollBar, null);
     mouseWheelHelper.MouseWheelMoved += new EventHandler<MouseWheelEventArgs>(mouseWheelHelper_MouseWheelMoved);
     return scrollBar;
 }
 public bool RemoveMouseWheelSupport(ScrollBar scrollBar)
 {
    if (mouseWheelHelper!= null)
    {
        try
        {
            mouseWheelHelper.RemoveWheelSupport(scrollBar);
            mouseWheelHelper = null;
            return true;
        }
        catch 
        {
            return false;
        }               
    }
    return false;
 }