Пример #1
0
        //public static bool RemoveMouseWheelSupport(ScrollViewer childScrollViewer)
        //{
        //   if (mouseWheelHelper!= null)
        //   {
        //       try
        //       {
        //           mouseWheelHelper.RemoveWheelSupport(childScrollViewer);
        //           mouseWheelHelper = null;
        //           return true;
        //       }
        //       catch
        //       {
        //           return false;
        //       }
        //   }
        //   return false;
        //}

        public static bool RemoveMouseWheelSupport(FrameworkElement mouseMoveElement)
        {
            if (mouseWheelHelper != null)
            {
                try
                {
                    mouseWheelHelper.RemoveWheelSupport(mouseMoveElement);
                    mouseWheelHelper = null;
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
            return(false);
        }
        //public static bool RemoveMouseWheelSupport(ScrollViewer childScrollViewer)
        //{
        //   if (mouseWheelHelper!= null)
        //   {
        //       try
        //       {
        //           mouseWheelHelper.RemoveWheelSupport(childScrollViewer);
        //           mouseWheelHelper = null;
        //           return true;
        //       }
        //       catch 
        //       {
        //           return false;
        //       }               
        //   }
        //   return false;
        //}

        public static bool RemoveMouseWheelSupport(FrameworkElement mouseMoveElement)
        {
            if (mouseWheelHelper != null)
            {
                try
                {
                    mouseWheelHelper.RemoveWheelSupport(mouseMoveElement);
                    mouseWheelHelper = null;
                    return true;
                }
                catch
                {
                    return false;
                }
            }
            return false;
        }
 public static ScrollViewer AddMouseWheelSupport(this ScrollViewer childScrollViewer, FrameworkElement mouseMoveElement, double scrollAmount)
 {
     mouseWheelHelper = new MouseWheelSupport(mouseMoveElement, null);
     return AddScrollViewerMouseWheelSupport(childScrollViewer, scrollAmount);
 }
 /// <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="parentScrollViewer">The parent <see cref="ScrollViewer"/> which contains another <see cref="ScrollViewer" /> which should have mouse wheel scrolling support.</param>
 /// <param name="childScrollViewer">A child <see cref="ScrollViewer"/> to add mouse wheel scrolling support to.</param>
 /// <param name="scrollAmount">The amount to scroll by when the mouse wheel is moved.</param>
 /// <returns>The child <see cref="ScrollViewer"/>.</returns>
 public static ScrollViewer AddMouseWheelSupport(this ScrollViewer parentScrollViewer, ScrollViewer childScrollViewer, double scrollAmount)
 {
     mouseWheelHelper = new MouseWheelSupport(childScrollViewer, parentScrollViewer);
     return AddScrollViewerMouseWheelSupport(childScrollViewer, scrollAmount);
 }
Пример #5
0
 /// <summary>
 /// This should be called exactly one time in the constructor of the application's main XAML
 /// code behind file, immediately after the call to InitializeComponent().
 /// </summary>
 /// <param name="applicationRootVisual">The application root visual. Just give a name to the root element of your application and pass it in here.</param>
 /// <param name="activationMode">Specifies whether the mouse wheel is associated with a <see cref="ScrollViewer" /> by simply hovering over it (OnHover) or if the user must explicitly assign focus to it before the wheel affects it (OnFocus).</param>
 public static void Initialize(FrameworkElement applicationRootVisual, MouseWheelAssociationMode activationMode)
 {
     MouseWheelSupport.RegisterRootVisual(applicationRootVisual);
     MouseWheelSupport.UseFocusBehaviorModel = (activationMode == MouseWheelAssociationMode.OnFocus);
 }
Пример #6
0
 public static ScrollViewer AddMouseWheelSupport(this ScrollViewer childScrollViewer, FrameworkElement mouseMoveElement, double scrollAmount)
 {
     mouseWheelHelper = new MouseWheelSupport(mouseMoveElement, null);
     return(AddScrollViewerMouseWheelSupport(childScrollViewer, scrollAmount));
 }
Пример #7
0
 /// <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="parentScrollViewer">The parent <see cref="ScrollViewer"/> which contains another <see cref="ScrollViewer" /> which should have mouse wheel scrolling support.</param>
 /// <param name="childScrollViewer">A child <see cref="ScrollViewer"/> to add mouse wheel scrolling support to.</param>
 /// <param name="scrollAmount">The amount to scroll by when the mouse wheel is moved.</param>
 /// <returns>The child <see cref="ScrollViewer"/>.</returns>
 public static ScrollViewer AddMouseWheelSupport(this ScrollViewer parentScrollViewer, ScrollViewer childScrollViewer, double scrollAmount)
 {
     mouseWheelHelper = new MouseWheelSupport(childScrollViewer, parentScrollViewer);
     return(AddScrollViewerMouseWheelSupport(childScrollViewer, scrollAmount));
 }