title: WPF Context Menus in Caliburn Micro
body: <p>I'm trying to get a context menu within a ListBox ItemTemplate to call a method on the parent view model, passing in the item that was clicked on as a parameter. I have this working for other buttons in the item template, but for the context menu it seems to be failing.</p>
  
  <p>I have the following xaml (abbreviated for clarity):</p>
  
  <pre><code>&lt;ListBox&gt;
      &lt;ListBox.GroupStyle&gt;
          &lt;GroupStyle&gt;
              ...
          &lt;/GroupStyle&gt;
      &lt;/ListBox.GroupStyle&gt;
      &lt;ListBox.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;Grid&gt;
                  &lt;Grid.ContextMenu&gt;
                      &lt;ContextMenu Name="cm"&gt;
                          &lt;MenuItem Header="Open" 
                                    cal:Message.Attach="Open($dataContext)"&gt;
  
                          &lt;/MenuItem&gt;
                  &lt;/Grid.ContextMenu&gt;
  
                  &lt;TextBlock VerticalAlignment="Center" &gt;
                      .. text..
                  &lt;/TextBlock&gt;
              &lt;/Grid&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  </code></pre>
  
  <p>I have a feeling this has to do with the fact that the visual tree is different, so Caliburn is unable to resolve the method reliably. I'm sure this is a common problem, and I've tried a few of the things I've found online, but nothing seems to be working.</p>
  
  <p>Any ideas??</p>