/// <summary> /// Moves position in table to the right except at last entry /// where it allows the row to be added and cursor flows naturally /// down. /// </summary> private void TallyGrid_PreviewKeyDown(object sender, KeyEventArgs e) { var uiElement = e.OriginalSource as UIElement; if (e.Key == Key.Tab) { TallyGrid.CommitEdit(); CalcAirDevices(); return; } if (e.Key == Key.Enter && uiElement != null) { TallyGrid.CommitEdit(); CalcAirDevices(); if (sender is DataGrid dgc) { int ccindx = dgc.CurrentColumn.DisplayIndex; if (ccindx < dgc.Columns.Count - 1) { uiElement.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); e.Handled = true; } } } }
private void TallyGrid_CurrentCellChanged(object sender, EventArgs e) { TallyGrid.CommitEdit(); CalcAirDevices(); }