I have a listview, with contextmenu associated to each listviewitem. But a click on a menuitem doesn't call the corresponding Command myCommand. myCommand is linked to a "Execute" and a "Can Execute" methods. The "Can Execute" method works, but not the "Execute" one. it has a parameter. If I remove the datacontext, the "Execute" Method is called, but the parameter is always null. My code in xaml:
<ListView.ContextMenu>
<ContextMenu>
<MenuItem Header="Open Directory "
DataContext="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
Command="{Binding OpenLink}"
CommandParameter="{Binding Path=LocalPath}"/>
</ContextMenu>
</ListView.ContextMenu>
Short explanation : Each Item from my list has a property LocalPath. When I right click on an item, and select "Open Directory", it is supposed to open the directory for this item. Thanks for your help
Niko