title: How to Pass Cell Information from DataGrid in WPF KeyBinding?
body: <p>I'm having a DataGrid to list the MobileInfo Collection. The DataGrid is Configured with <code>SelectionUnit="FullRow"</code>. If I Click the any Row then it selects the entire row with additionally it points the Cell with border where the Mouse was hit. The Border Selection moves while on Keyboard navigation For Example : <code>Left</code>, <code>Right</code>, <code>Up</code> and <code>Down</code>. Based on the Cell Selection I wish to Pass the Information about the Cell.</p>
  
  <p>Refer the Image it has the Output Screen </p>
  
  <p><a href="https://i.stack.imgur.com/oZlzL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oZlzL.jpg" alt="Cell Selected in OS Column"></a></p>
  
  <p>In the above Screen Shot the Android is Selected, Based on Keyboard Navigation, the Cell selection gets changed.</p>
  
  <p>My XAML Source Code:</p>
  
  <pre><code>&lt;DataGrid  AutoGenerateColumns="False" ItemsSource="{Binding MobileList, UpdateSourceTrigger=PropertyChanged}" SelectionUnit="FullRow" IsReadOnly="True"&gt;
      &lt;DataGrid.InputBindings&gt;
          &lt;KeyBinding Key="C" Modifiers="Ctrl" Command="{Binding Path=DataContext.CopyToClipBoardCommand}" CommandParameter="{Binding }" /&gt;
      &lt;/DataGrid.InputBindings&gt;
      &lt;DataGrid.Columns&gt;
          &lt;!--Column 1--&gt;
          &lt;DataGridTextColumn Binding="{Binding MobileName}" Header="Name" /&gt;
          &lt;!--Column 2--&gt;
          &lt;DataGridTextColumn Binding="{Binding MobileOS}" Header="OS" /&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <blockquote>
    <p>Note: Don't Change the <strong>SelectionUnit</strong> in the DataGrid</p>
  </blockquote>
  
  <p>Kindly provide your solution, how to pass the Cell Information based on Keyboard Navigation</p>
  
  <p>The C# Source Code associated with the XAML DataGrid</p>
  
  <pre><code>public class GridViewModel
  {
      public ObservableCollection&lt;MobileInfo&gt; MobileList { get; set; }
  
      public GridViewModel()
      {
          MobileList = new ObservableCollection&lt;MobileInfo&gt;();
          MobileList.Add(new MobileInfo  { MobileName = "iPhone", MobileOS = "iOS" });
          MobileList.Add(new MobileInfo { MobileName = "Xperia", MobileOS = "Android" });
          MobileList.Add(new MobileInfo { MobileName = "Lumina", MobileOS = "Windows" });
      }
  
  }
  
  public class MobileInfo
  {
      public string MobileName { get; set; }
      public string MobileOS { get; set; }
  }
  </code></pre>