Inheritance: System.Windows.Input.MouseEventArgs
Example #1
0
        private static void HandleMouseHorizontalWheel(IntPtr wParam)
        {
            int tilt = Win32.HiWord(wParam);

            if (tilt == 0)
            {
                return;
            }

            IInputElement element = Mouse.DirectlyOver;

            if (element == null)
            {
                return;
            }

            if (!(element is UIElement))
            {
                element = UIHelpers.FindAncestor <UIElement>(element as DependencyObject);
            }
            if (element == null)
            {
                return;
            }

            var ev = new MouseHorizontalWheelEventArgs(Mouse.PrimaryDevice, Environment.TickCount, tilt)
            {
                RoutedEvent = PreviewMouseHorizontalWheelEvent
                              //Source = handledWindow
            };

            // first raise preview
            element.RaiseEvent(ev);
            if (ev.Handled)
            {
                return;
            }

            // then bubble it
            ev.RoutedEvent = MouseHorizontalWheelEvent;
            element.RaiseEvent(ev);
        }
        private static void HandleMouseHorizontalWheel(IntPtr wParam)
        {
            int tilt = Win32.HiWord(wParam);
            if (tilt == 0)
            {
                return;
            }

            IInputElement element = Mouse.DirectlyOver;
            if (element == null)
            {
                return;
            }

            if (!(element is UIElement))
            {
                element = UIHelpers.FindAncestor<UIElement>(element as DependencyObject);
            }
            if (element == null)
            {
                return;
            }

            var ev = new MouseHorizontalWheelEventArgs(Mouse.PrimaryDevice, Environment.TickCount, tilt)
            {
                RoutedEvent = PreviewMouseHorizontalWheelEvent
                //Source = handledWindow
            };

            // first raise preview
            element.RaiseEvent(ev);
            if (ev.Handled)
            {
                return;
            }

            // then bubble it
            ev.RoutedEvent = MouseHorizontalWheelEvent;
            element.RaiseEvent(ev);
        }