title: WPF : MenuItem.CommandParameter binding set to null
body: <p>I have the following ContextMenu defined for my data grid:</p>
  
  <pre><code>&lt;igDP:XamDataGrid.ContextMenu&gt;
      &lt;ContextMenu ItemsSource="{Binding CommandViewModels}"                     &gt;
          &lt;ContextMenu.ItemContainerStyle&gt;
              &lt;Style TargetType="MenuItem"&gt;
                  &lt;Setter Property="Command" Value="{Binding Command}" /&gt;
                  &lt;Setter Property="CommandParameter" Value="{Binding CommandParameter}" /&gt;
                  &lt;Setter Property="Header" Value="{Binding Name}" /&gt;
                  &lt;Setter Property="Icon" Value="{Binding Icon}" /&gt;
              &lt;/Style&gt;
          &lt;/ContextMenu.ItemContainerStyle&gt;
      &lt;/ContextMenu&gt;
  &lt;/igDP:XamDataGrid.ContextMenu&gt;
  </code></pre>
  
  <p>A CommandViewModel class is defined as follows: </p>
  
  <pre><code>public class CommandViewModel : ICommandViewModel
      {
          public CommandViewModel(string name, Image icon, ICommand command, object commandParameter = null, int index = 0)
          {
              Name = name;
              Icon = icon;
              Command = command;
              CommandParameter = commandParameter;
              Index = index;
          }
  
          public string Name { get; set; }
          public Image Icon { get; set; }
          public ICommand Command { get; set; }
          public object CommandParameter { get; set; }
          public int Index { get; set; }     
      }
  </code></pre>
  
  <p>When I right click on a row in the grid, each MenuItem of the ContextMenu is correctly styled.  The icon, label and command of the MenuItem is as expected.  However, the command parameter, CommandViewModel.CommandParameter, that should be passed as argument to the RelayCommand bound to MenuItem.Command is null.</p>
  
  <p>I am fairly certain that the command parameter available for the binding is not null.  This is WPF application running on .NET 4.0.</p>
  
  <p>Anyone experienced this?  </p>