title: WPF datagrid and the tab key
body: <p>Another datagrid keybindings question</p>
  
  <p>I have a datagrid. It has selection mode set to FullRow and KeyboardNavigation.TabNavigation="Once" which I was hoping would get my desired result but it doesn't.  </p>
  
  <p>When the tab key is pressed when the datagrid has focus it will tab over each column in the grid one by one. So if I tab into the grid which has 4 columns, I will have to press tab 4 times to go to the next tabindex.  </p>
  
  <p>What I want is for the tab key to tab right out of the datagrid on first press and give focus to the next tabindex... if that makes sense.  </p>
  
  <p>I have tried overriding the tab key in the keydown event handler like so.</p>
  
  <pre><code>class BetterDataGrid : DataGrid
  {
    ..............
    protected override void OnKeyDown(System.Windows.Input.KeyEventArgs e)
    {
      ..............
      if (e.Key == Key.Tab)
      {
          Console.WriteLine("TAB");
          MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
      }
      .........
    }
  </code></pre>
  
  <p>It does write "TAB" to the console but the tab still keeps it's default behavior. Not sure if this is the right way to go the next tabindex, but then this should make the tab key do nothing but write to the console or cause an exception.<br>
  Makes me think it's impossible to override the tab key behavior.  </p>
  
  <p>Hoping for some helpful input.<br>
  As always, thanks in advance.</p>