title: CTRL + C is not detected in WPF DataGrid
body: <p>I have a WPF applicaiton where the MainWindow class have <code>&lt;Window.CommandBindings&gt;</code> and <code>&lt;Window.InputBindings&gt;</code> so I can detect <kbd>CTRL</kbd> + <kbd>X</kbd>, <kbd>CTRL</kbd> + <kbd>C</kbd> and <kbd>CTRL</kbd> + <kbd>V</kbd> commands.</p>
  
  <p>The MainWindow contains a DataGrid where I want to select a row and copy the data in the row with the <kbd>CTRL</kbd> + <kbd>C</kbd> command. When a row is selected in the DataGrid the <kbd>CTRL</kbd> + <kbd>C</kbd> command is no longer detected in the MainWindow. <kbd>CTRL</kbd> + <kbd>X</kbd> and <kbd>CTRL</kbd> + <kbd>V</kbd> are still detected.</p>
  
  <p>I have managed to reproduce this problem with a very simple example. Just copy and paste the code below, it should compile and run on the go. Then do the following:</p>
  
  <ol>
  <li>Press either <kbd>CTRL</kbd> + <kbd>X</kbd>, <kbd>CTRL</kbd> + <kbd>C</kbd> or <kbd>CTRL</kbd> + <kbd>V</kbd>: A popup window will say what command was activated.</li>
  <li>Select a row in the DataGrid and then press <kbd>CTRL</kbd> + <kbd>C</kbd>: Nothing will happen.</li>
  <li><kbd>CTRL</kbd> + <kbd>X</kbd> or <kbd>CTRL</kbd> + <kbd>V</kbd> will still be detected.</li>
  </ol>
  
  <p><strong>MainWindow.XAML code</strong>
  </p>
  
  <pre><code>&lt;!-- Commands for hot keys --&gt;
  &lt;Window.CommandBindings&gt;
  
      &lt;!-- Source --&gt;
      &lt;!-- http://stackoverflow.com/questions/4682915/defining-menuitem-shortcuts --&gt;
  
      &lt;CommandBinding Command="Cut" Executed="btnCut_Click" /&gt;
      &lt;CommandBinding Command="Copy" Executed="btnCopy_Click" /&gt;
      &lt;CommandBinding Command="Paste" Executed="btnPaste_Click" /&gt;
  
  &lt;/Window.CommandBindings&gt;
  
  &lt;!-- Hot keys --&gt;
  &lt;Window.InputBindings&gt;
      &lt;KeyBinding Key="X" Modifiers="Control" Command="Cut" /&gt;
      &lt;KeyBinding Key="C" Modifiers="Control" Command="Copy" /&gt;
      &lt;KeyBinding Key="V" Modifiers="Control" Command="Paste" /&gt;
  &lt;/Window.InputBindings&gt;
  
  &lt;Grid&gt;
      &lt;DataGrid Name="dgPersons" HorizontalScrollBarVisibility="Auto" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Extended" GridLinesVisibility="None" Background="White" Margin="75,59,35,104"&gt;
  
          &lt;DataGrid.CellStyle&gt;
              &lt;Style TargetType="DataGridCell"&gt;
                  &lt;Setter Property="BorderThickness" Value="0" /&gt;
                  &lt;Setter Property="FocusVisualStyle" Value="{x:Null}" /&gt;
              &lt;/Style&gt;
          &lt;/DataGrid.CellStyle&gt;
  
          &lt;DataGrid.Columns&gt;
  
              &lt;!-- Name --&gt;
              &lt;DataGridTextColumn Header="Name" Width="100" Binding="{Binding Name, Mode=OneTime}" /&gt;
  
          &lt;/DataGrid.Columns&gt;
      &lt;/DataGrid&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>MainWindow.cs code</strong></p>
  
  <pre><code>public partial class MainWindow : Window
  {
      ObservableCollection&lt;Person&gt; persons = new ObservableCollection&lt;Person&gt;();
  
      public MainWindow()
      {
          InitializeComponent();
  
          Person person1 = new Person("Person1");
          Person person2 = new Person("Person2");
          Person person3 = new Person("Person3");
  
          persons.Add(person1);
          persons.Add(person2);
          persons.Add(person3);
  
          dgPersons.ItemsSource = persons;
      }
  
      private void btnCut_Click(object sender, ExecutedRoutedEventArgs e)
      {
          MessageBox.Show("CUT command activated");
      }
  
      private void btnCopy_Click(object sender, ExecutedRoutedEventArgs e)
      {
          MessageBox.Show("COPY command activated");
      }
  
      private void btnPaste_Click(object sender, ExecutedRoutedEventArgs e)
      {
          MessageBox.Show("PASTE command activated");
      }
  }
  
  public class Person
  {
      string name;
  
      public Person(string name)
      {
          this.name = name;
      }
  
      public string Name
      {
          get { return name; }
      }
  }
  </code></pre>
  
  <p>How do I get <kbd>CTRL</kbd> + <kbd>C</kbd> working when a row is selected in the DataGrid?</p>