internal void HandlePageDownNavigation() { DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this); if (dataGridContext == null) { return; } DataGridControl dataGridControl = dataGridContext.DataGridControl; FrameworkElement hostPanel = dataGridControl.ItemsHost; if (hostPanel != null) { // First thing to do here is the force the relayout of the ItemsHostPanel so that the target element gets "visible" hostPanel.UpdateLayout(); // Then retrieve the last visible item in this panel FrameworkElement lastVisibleItem = ScrollViewerHelper.GetLastVisibleContainer( dataGridControl, hostPanel, this) as FrameworkElement; if (lastVisibleItem != null) { DataGridContext lastVisibleItemDataGridContext = DataGridControl.GetDataGridContext(lastVisibleItem); object oldItem = dataGridContext.InternalCurrentItem; bool focused; // Make the last visible item the current and focused. // in order to cancel the current column in mixed mode when paged-Down if (dataGridControl.NavigationBehavior == NavigationBehavior.RowOrCell) { focused = dataGridControl.SetFocusHelper( lastVisibleItem, null, true, true); } else { focused = dataGridControl.SetFocusHelper( lastVisibleItem, lastVisibleItemDataGridContext.CurrentColumn, true, true); } if (((!focused) || (oldItem == lastVisibleItemDataGridContext.InternalCurrentItem)) && (!dataGridControl.HasValidationError)) { // The current item was already the first item, move focus down. DataGridItemsHost.ProcessMoveFocus(Key.Down); } } } }
protected virtual void HandlePageDownKey(KeyEventArgs e) { // Ensure to at least process the PageDown as Key.Down // to avoid the TableViewScrollViewer to process the key // directly without moving the focus. e.Handled = DataGridItemsHost.ProcessMoveFocus(Key.Down); // We were not able to move focus out of the // SynchronizedScrollViewer but the focus is still inside. // Mark the key as handled to avoid the DataGridScrollViewer // to process the PageDown. if (!e.Handled && this.IsKeyboardFocusWithin) { e.Handled = true; } }
protected virtual void HandleRightKey(KeyEventArgs e) { e.Handled = DataGridItemsHost.ProcessMoveFocus(e.Key); }