Example #1
0
        private static void HandleDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 2)
            {
                Control ctrl = (Control)sender;
                MouseButtonEventArgs doubleClick = new MouseButtonEventArgs(e.MouseDevice, e.Timestamp, e.ChangedButton, e.StylusDevice);

                if ((e.RoutedEvent == UIElement.PreviewMouseLeftButtonDownEvent) ||
                    (e.RoutedEvent == UIElement.PreviewMouseRightButtonDownEvent))
                {
                    doubleClick.RoutedEvent = PreviewMouseDoubleClickEvent;
                    doubleClick.Source      = e.OriginalSource; // Set OriginalSource because initially is null
                    doubleClick.OverrideSource(e.Source);
                    ctrl.OnPreviewMouseDoubleClick(doubleClick);
                }
                else
                {
                    doubleClick.RoutedEvent = MouseDoubleClickEvent;
                    doubleClick.Source      = e.OriginalSource; // Set OriginalSource because initially is null
                    doubleClick.OverrideSource(e.Source);
                    ctrl.OnMouseDoubleClick(doubleClick);
                }

                // If MouseDoubleClick event is handled - we delegate the state to original MouseButtonEventArgs
                if (doubleClick.Handled)
                {
                    e.Handled = true;
                }
            }
        }
Example #2
0
 // Token: 0x060044B2 RID: 17586 RVA: 0x0013804C File Offset: 0x0013624C
 private static void HandleDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (e.ClickCount == 2)
     {
         Control control = (Control)sender;
         MouseButtonEventArgs mouseButtonEventArgs = new MouseButtonEventArgs(e.MouseDevice, e.Timestamp, e.ChangedButton, e.StylusDevice);
         if (e.RoutedEvent == UIElement.PreviewMouseLeftButtonDownEvent || e.RoutedEvent == UIElement.PreviewMouseRightButtonDownEvent)
         {
             mouseButtonEventArgs.RoutedEvent = Control.PreviewMouseDoubleClickEvent;
             mouseButtonEventArgs.Source      = e.OriginalSource;
             mouseButtonEventArgs.OverrideSource(e.Source);
             control.OnPreviewMouseDoubleClick(mouseButtonEventArgs);
         }
         else
         {
             mouseButtonEventArgs.RoutedEvent = Control.MouseDoubleClickEvent;
             mouseButtonEventArgs.Source      = e.OriginalSource;
             mouseButtonEventArgs.OverrideSource(e.Source);
             control.OnMouseDoubleClick(mouseButtonEventArgs);
         }
         if (mouseButtonEventArgs.Handled)
         {
             e.Handled = true;
         }
     }
 }