Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
Interaction.Triggers + xamContextMenu
posted

Hello,

I have a the following code (Code #1) attached to a XamDataGrid:

<ig:ContextMenuManager>
   <ig:ContextMenuManager.ContextMenu>
      <ig:XamContextMenu>
          <ig:XamMenuItem Header="Edit">
              <i:Interaction.Triggers>
                  <i:EventTrigger EventName="Click">
                      <i:InvokeCommandAction Command="{Binding Path=MyCommand}" />
                   </i:EventTrigger>
              </i:Interaction.Triggers>
           </ig:XamMenuItem>
       </ig:XamContextMenu>
   </ig:ContextMenuManager.ContextMenu>
</ig:ContextMenuManager>

where
xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

The command does not work as intended, nothing is being shown.
The following code (Code #2) works as intended:
<Button Content="Save" Height="20"> <i:Interaction.Triggers>     <i:EventTrigger EventName="Click">         <i:InvokeCommandAction Command="{Binding Path=MyCommand}"/>         </i:EventTrigger>     </i:Interaction.Triggers> </Button>

When I change MyCommand in Code #2 to MyCommand2 (which doesn't exist) it tries to find the property MyCommand2 on the DataContext
MyCommand does actually exist on the DataContext (as shown on Code #2)

The command actually is
private ICommand _myCommand;
public ICommand MyCommand
{ get     {     return _myCommand ?? (_myCommand = new RelayCommand(param => MessageBox.Show("TEST!")));     }             }

I'm using the MVVM architecture.

Why doesn't the Code #1 work? Any ideas?

Thank you!
Parents
No Data
Reply
  • 9694
    posted

    You're right. It looks like the InvokeCommandAction Behavior fails to work in a XamMenuItem in a XamContextMenu. I've reported this as a bug and it is assigned  Case ID: CAS-63623-2YJ4B9.

    I apologize for the inconvenience!

Children