private void TextBox_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { e.Handled = true; if (_fromRowEnter) { _fromRowEnter = false; return; } else { tbx_filter.SelectAll(); tbx_filter.Focus(); return; } } if (e.Key == Key.Down && ReservesGrid.SelectedIndex + 1 < ReservesGrid.Items.Count) { ReservesGrid.SelectedIndex++; var cell = PosTools.GetCell(ReservesGrid, ReservesGrid.SelectedIndex, 3); // ReservesGrid.CurrentCell = new DataGridCellInfo(ReservesGrid.CurrentItem, ReservesGrid.Columns[0]); var tbx = PosTools.GetChildOfType <TextBox>(cell); tbx.Focus(); // tbx.SelectAll(); } else if (e.Key == Key.Up && ReservesGrid.SelectedIndex > 0) { ReservesGrid.SelectedIndex--; FocusSelectedItemText(); } e.Handled = true; }
public void FocusSelectedItemText() { if (ActiveGrid == ReservesGrid1) { return; } if (ActiveGrid.SelectedIndex >= 0) { var cell = PosTools.GetCell(ActiveGrid, ActiveGrid.SelectedIndex, 3); var tbx = PosTools.GetChildOfType <TextBox>(cell); if (tbx != null) { tbx.Focus(); } } }
private void ReservesGrid_OnKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { e.Handled = true; if (ActiveGrid.SelectedIndex >= 0) { var cell = PosTools.GetCell(ActiveGrid, ActiveGrid.SelectedIndex, 3); var tbx = PosTools.GetChildOfType <TextBox>(cell); if (!tbx.IsFocused) { _fromRowEnter = true; FocusSelectedItemText(); } } } }