Beispiel #1
0
 private void MultiSelectDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (DoubleClickCommand != null && DoubleClickCommand.CanExecute(SelectedItem))
     {
         DoubleClickCommand.Execute(SelectedItem);
     }
 }
Beispiel #2
0
        protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
        {
            if (DoubleClickCommand?.CanExecute(DoubleClickCommandParameter) ?? false)
            {
                DoubleClickCommand.Execute(DoubleClickCommandParameter);
            }

            base.OnMouseDoubleClick(e);
        }
Beispiel #3
0
        private void OnRowDoubleClickl(object sender, MouseButtonEventArgs e)
        {
            DataGridRow row = sender as DataGridRow;

            var obj = row?.Item;

            OnDoubleClickItem?.Invoke(this, obj);
            // Some operations with this row

            if (DoubleClickCommand != null && DoubleClickCommand.CanExecute(obj))
            {
                DoubleClickCommand.Execute(obj);
            }
        }
Beispiel #4
0
 // Forward events to any registed commands
 protected void ForwardEventToCommand(Wpf.EventType eventType)
 {
     switch (eventType)
     {
     case Wpf.EventType.LeftButtonDoubleClick:
     case Wpf.EventType.MiddleButtonDoubleClick:
     case Wpf.EventType.RightButtonDoubleClick:
         // Handle double click
         if (DoubleClickCommand?.CanExecute(DoubleClickCommandParameter) == true)
         {
             DoubleClickCommand?.Execute(DoubleClickCommandParameter);
         }
         break;
     }
 }
Beispiel #5
0
 protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
 {
     if (e.ClickCount == 2)
     {
         if (DoubleClickCommand != null)
         {
             if (DoubleClickCommand.CanExecute(DataContext))
             {
                 DoubleClickCommand.Execute(DataContext);
                 e.Handled = true;
                 return;
             }
         }
     }
 }
Beispiel #6
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.Key == Key.Delete)
            {
                if (DeleteCommand?.CanExecute(DeleteCommandParameter) ?? false)
                {
                    DeleteCommand.Execute(DeleteCommandParameter);
                    DeleteLine();
                }
            }
            else if (e.Key == Key.Enter)
            {
                if (DoubleClickCommand?.CanExecute(DoubleClickCommandParameter) ?? false)
                {
                    DoubleClickCommand.Execute(DoubleClickCommandParameter);
                }
            }

            base.OnKeyDown(e);
        }