title: Select a wpf datagrid row programmaticaly with the highlighting
body: <p>I created a datagrid in WPF with a few rows.
  I created four buttons on my wpf grid in order to navigate between the rows :  [&lt;&lt;] -- [&lt;] -- [>] --  [>>]</p>
  
  <p>I use the SelectedItem function in order to set the rows.
  My problem is that the highlighting appear to be bad ( slow ) to appear ( it's a bit difficult to explain ).</p>
  
  <p>When i use the keybord arrow (up and down) in order to  between the rows, the highlighting is fast and immediate. Whit my code behind my button, the highlighting is a bit slow and strange.</p>
  
  <p><strong>Here is my code</strong> </p>
  
  <pre><code>        private void Button_Click_Goto_Premier(object sender, RoutedEventArgs e)
      {
          myDataGridEvtCode.SelectedItem = myDataGridEvtCode.Items[0];
          myDataGridEvtCode.Focus();
      }
  
      private void Button_Click_Goto_Precedent(object sender, RoutedEventArgs e)
      {
          if (myDataGridEvtCode.SelectedIndex &gt; 0)
          {
              myDataGridEvtCode.SelectedItem = myDataGridEvtCode.Items[myDataGridEvtCode.SelectedIndex - 1];
              myDataGridEvtCode.Focus();
          }
      }
  
      private void Button_Click_Goto_Suivant(object sender, RoutedEventArgs e)
      {
          if (myDataGridEvtCode.SelectedIndex &lt; myDataGridEvtCode.Items.Count - 1)
          {
              myDataGridEvtCode.SelectedItem = myDataGridEvtCode.Items[myDataGridEvtCode.SelectedIndex + 1];
              myDataGridEvtCode.Focus();
          }
      }
  
      private void Button_Click_Goto_Dernier(object sender, RoutedEventArgs e)
      {
          myDataGridEvtCode.SelectedItem = myDataGridEvtCode.Items[myDataGridEvtCode.Items.Count-1];
          myDataGridEvtCode.Focus();
      }
  </code></pre>
  
  <p>Anyone have some ideas about this ?</p>
  
  <p>Thanks a lot my friends :)</p>