title: failed to create menuitem click method in resource directory
body: <p>I'm struggling with this below problem. my style file in resource directory. but it can't apply click method to context menu item. it's showing below this error. please help me how can i achieve this.</p>
  
  <p><strong>Error : "'Failed to create a 'Click' from the text 'OnMenuItemClick'.' Line number '10' and line position '35'."</strong></p>
  
  <pre><code>    &lt;ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns:src="clr-namespace:System;assembly=mscorlib"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  &lt;ObjectDataProvider x:Key="date" ObjectType="{x:Type src:DateTime}"/&gt;
  &lt;Style x:Key="ContextMenuStyle1" TargetType="{x:Type ContextMenu}"&gt;
      &lt;Setter Property="BorderThickness" Value="0"/&gt;
      &lt;Setter Property="BorderBrush" Value="Transparent"/&gt;
  &lt;/Style&gt;
  &lt;ContextMenu x:Key="ListViewContext" Style="{StaticResource ContextMenuStyle1}"&gt;
      &lt;MenuItem Header="Create" Click="OnMenuItemClick" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"&gt;&lt;/MenuItem&gt;
  &lt;/ContextMenu&gt;
  &lt;ContextMenu x:Key="GridItemContext" Style="{StaticResource ContextMenuStyle1}"&gt;
      &lt;MenuItem Header="Modify" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/&gt;
      &lt;MenuItem Header="Delete" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/&gt;
  &lt;/ContextMenu&gt;
  &lt;Style x:Key="ListViewGrid" TargetType="{x:Type ListView}"&gt;
      &lt;Setter Property="BorderBrush" Value="#FFDFDFE2"/&gt;
      &lt;Setter Property="BorderThickness" Value="1"/&gt;
      &lt;Setter Property="Background" Value="#faf2f2"/&gt;
      &lt;Setter Property="ContextMenu" Value="{StaticResource ListViewContext}"/&gt;
  &lt;/Style&gt;
  &lt;Style TargetType="{x:Type ListViewItem}"&gt;
      &lt;Setter Property="ContextMenu" Value="{StaticResource GridItemContext}"/&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="ListViewItem"&gt;
                  &lt;Border CornerRadius="0" SnapsToDevicePixels="True"  &gt;
                      &lt;Border Name="InnerBorder" CornerRadius="0" BorderThickness="0,0,0,1" BorderBrush="#FFDFDFE2"&gt;
                          &lt;Grid Background="#FFEFEFEF" Name="Trg" Height="20"&gt;
                              &lt;GridViewRowPresenter /&gt;
                          &lt;/Grid&gt;
                      &lt;/Border&gt;
                  &lt;/Border&gt;
                  &lt;ControlTemplate.Triggers&gt;
                      &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                          &lt;Setter TargetName="Trg" Property="Background" Value="#FFDFDFE2" /&gt;
                      &lt;/Trigger&gt;
                      &lt;Trigger Property="IsSelected" Value="True"&gt;
                          &lt;Setter TargetName="Trg" Property="Background" Value="#FFDFDFE2" /&gt;
                      &lt;/Trigger&gt;
                      &lt;MultiTrigger&gt;
                          &lt;MultiTrigger.Conditions&gt;
                              &lt;Condition Property="IsSelected" Value="True" /&gt;
                              &lt;Condition Property="IsMouseOver" Value="True" /&gt;
                          &lt;/MultiTrigger.Conditions&gt;
                      &lt;/MultiTrigger&gt;
                  &lt;/ControlTemplate.Triggers&gt;
  
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>