Example #1
0
        protected virtual void HandlePreviewTabKey(KeyEventArgs e)
        {
            if (e.Handled)
            {
                return;
            }

            DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this);

            if (dataGridContext == null)
            {
                return;
            }

            DataGridContext currentDataGridContext = dataGridContext.DataGridControl.CurrentContext;

            if (currentDataGridContext == null)
            {
                return;
            }

            DependencyObject container = currentDataGridContext.GetContainerFromItem(currentDataGridContext.InternalCurrentItem);

            if (container != null)
            {
                KeyboardNavigationMode tabbingMode = KeyboardNavigation.GetTabNavigation(container);

                if (tabbingMode != KeyboardNavigationMode.None)
                {
                    if ((Keyboard.Modifiers == ModifierKeys.None) || (Keyboard.Modifiers == ModifierKeys.Shift))
                    {
                        DataGridItemsHost.BringIntoViewKeyboardFocusedElement();

                        //Force the "inline" relayout of the panel
                        //This has no effect if the panel do not have to be updated.
                        this.UpdateLayout();
                    }
                }
            }
        }
Example #2
0
 protected virtual void HandlePreviewDownKey(KeyEventArgs e)
 {
     DataGridItemsHost.BringIntoViewKeyboardFocusedElement();
     this.UpdateLayout();
 }