title: Caliburn Micro Datagrid Context Menu
body: <p>My items from context menu are not executing.
  My xaml:</p>
  
  <pre><code>&lt;UserControl
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
           xmlns:local="clr-namespace:arFirmaKomp.Views"
           xmlns:arFirmaKomp="clr-namespace:arFirmaKomp" x:Class="arFirmaKomp.Views.ArKlienciView"
           xmlns:helpers="clr-namespace:arFirmaKomp.ViewHelpers"
           xmlns:cal="http://www.caliburnproject.org"
           mc:Ignorable="d" Height="600" Width="1200" &gt;
  &lt;Grid&gt;
      &lt;ComboBox x:Name="ArKlienciList" SelectedItem="{Binding Path=WybranyArKlient, Mode=OneWayToSource}" DisplayMemberPath="PodmiotyOdbiorcaNazwaSkrocona" HorizontalAlignment="Left" Margin="128,49,0,0" VerticalAlignment="Top" Width="134" Height="22" /&gt;
      &lt;DataGrid x:Name="ArKlienciList2" ItemsSource="{Binding Path=ArKlienciICView}" SelectedItem="{Binding SelectedItem}"
                cal:Message.Attach="[Event CellEditEnding]=[Action SaveChanges()];[Event MouseDoubleClick] = [Action RowSelect()]"
                RowDetailsVisibilityMode="VisibleWhenSelected" Margin="17,80,10,20" EnableRowVirtualization="True" AutoGenerateColumns="False"
                Tag="{Binding DataContext, RelativeSource={RelativeSource Self}}" &gt;
  
          &lt;DataGrid.Resources&gt;
              &lt;helpers:BindingProxy x:Key="proxy" Data="{Binding}" /&gt;
              &lt;ContextMenu x:Key="ContextMenu" cal:Action.TargetWithoutContext="{Binding}" IsOpen="{Binding Data.IsContextMenuOpen, Source={StaticResource proxy}}"&gt;
                  &lt;MenuItem Header="Open" 
                            cal:Message.Attach="Open($dataContext)"&gt;
                  &lt;/MenuItem&gt;
              &lt;/ContextMenu&gt;
          &lt;/DataGrid.Resources&gt;
  
          &lt;DataGrid.Columns&gt;
              &lt;DataGridTextColumn x:Name="idColumn" Width="SizeToHeader" Header="Id" Binding="{Binding Id}"/&gt;
              &lt;DataGridTextColumn x:Name="nexoKlientNabywcaColumn" Width="SizeToHeader" Header="Nexo Klient Nabywca" Binding="{Binding PodmiotyNabywcaNazwaSkrocona,Mode=OneWay}"&gt;
              &lt;/DataGridTextColumn&gt;
              &lt;DataGridTextColumn x:Name="nexoKlientOdbiorcaColumn" Width="SizeToHeader" Header="Nexo Klient Odbiorca" Binding="{Binding PodmiotyOdbiorcaNazwaSkrocona,Mode=OneWay}"/&gt;
              &lt;DataGridTextColumn x:Name="nexoKlientOdbiorcaTelefonColumn" Width="SizeToHeader" Header="Nexo Odbiorca Telefon" Binding="{Binding OdbiorcaTelefon,Mode=OneWay}"/&gt;
          &lt;/DataGrid.Columns&gt;
  
  
          &lt;DataGrid.RowStyle&gt;
              &lt;Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}"&gt;
                  &lt;Setter Property="ContextMenu" Value="{StaticResource ContextMenu}" /&gt;
              &lt;/Style&gt;
          &lt;/DataGrid.RowStyle&gt;
  
      &lt;/DataGrid&gt;
      &lt;TextBox HorizontalAlignment="Left" x:Name="FilterString" Height="19" Margin="128,15,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="134"/&gt;
      &lt;Label Content="filtr odbiorca" HorizontalAlignment="Left" Height="26" Margin="17,15,0,0" VerticalAlignment="Top" Width="92"/&gt;
  
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>My viewmodel - contextmenu part:</p>
  
  <pre><code>    public void Open(object source)
      {
          MessageBox.Show((string)source);
      }
  </code></pre>
  
  <p>My bindingProxy is taken from <a href="https://www.thomaslevesque.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherited/" rel="nofollow noreferrer">Thomas Levesque Blog</a></p>
  
  <p>I can see this context menu, and as I saw in other similar posts context menu is not connected with my ViewModel, and I don't know how to connect it. Contextmenu should make some action with the selected row as a parameter.</p>