title: DataGrid ContextMenu MenuItems are sometimes disabled
body: <p>I have a <code>DataGrid</code> and I do not know, why the <code>MenuItems</code> of <code>ContextMenu</code> are <a href="https://i.stack.imgur.com/b6KbZ.png" rel="nofollow noreferrer">sometimes enabled</a> and <a href="https://i.stack.imgur.com/OyKSk.png" rel="nofollow noreferrer">sometimes disabled</a>.</p>
  
  <pre><code>&lt;DataGrid ItemsSource="{Binding Values}"&gt;
      &lt;DataGrid.ContextMenu&gt;
          &lt;ContextMenu&gt;
              &lt;MenuItem Command="Copy" /&gt;
              &lt;MenuItem Command="Paste" /&gt;
              &lt;MenuItem Command="Delete" /&gt;
          &lt;/ContextMenu&gt;
      &lt;/DataGrid.ContextMenu&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>What can be the cause for that? I did not find any code, which is responsible for setting the <a href="https://msdn.microsoft.com/en-US/library/system.windows.input.icommand.canexecute.aspx" rel="nofollow noreferrer"><code>ICommand.CanExecute</code></a> or the <a href="https://msdn.microsoft.com/en-US/library/system.windows.uielement.isenabled.aspx" rel="nofollow noreferrer"><code>MenuItem.IsEnabled</code></a>.</p>
  
  <p>Please tell me which information I still need to provide.</p>
  
  <hr>
  
  <p><strong>@Maverik:</strong> I do not wrote any code for those three standard .NET commands:</p>
  
  <ul>
  <li><a href="https://msdn.microsoft.com/en-us/library/system.windows.input.applicationcommands.delete.aspx" rel="nofollow noreferrer"><code>ApplicationCommands.Delete</code></a> </li>
  <li><a href="https://msdn.microsoft.com/en-us/library/system.windows.input.applicationcommands.copy.aspx" rel="nofollow noreferrer"><code>ApplicationCommands.Copy</code></a> </li>
  <li><a href="https://msdn.microsoft.com/en-us/library/system.windows.input.applicationcommands.paste.aspx" rel="nofollow noreferrer"><code>ApplicationCommands.Paste</code></a></li>
  </ul>