private void DG_PreviewKeyDown(object sender, KeyEventArgs e) { if (!isEditing) { if (Keyboard.IsKeyDown(Key.LeftCtrl)) { if (Keyboard.IsKeyDown(Key.Z)) { dgvm.SuppressEvents = true; dgvm.InvokeUndo(); dgvm.SuppressEvents = false; } else if (Keyboard.IsKeyDown(Key.F)) { dgvm.SuppressEvents = true; dgvm.InvokeRedo(); dgvm.SuppressEvents = false; } e.Handled = true; } } else if (e.Key == Key.Tab) { DG.CommitEdit(DataGridEditingUnit.Cell, true); } }
private void DG_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (isEditing) { isEditing = false; DG.CommitEdit(DataGridEditingUnit.Row, true); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { /* Testando, percebi que a combinação das 3 linhas abaixo é justamente o que permite * fechar a janela de NodeList e manter o valor que estava em edição. */ DG.CommitEdit(); DG.RaiseEvent(new RoutedEventArgs(UIElement.LostFocusEvent)); DG.CommitEdit(); e.Cancel = true; //Fechar nunca tem efeito nenhum. this.Visibility = Visibility.Hidden; //Escondendo App.MW.Activate(); }