I'm trying to add a ContextMenu to items in a ListBox in WPF;
<ListBox.ItemTemplate>
<DataTemplate>
<Border>
<Grid>
<Grid.ContextMenu>
<ContextMenu>
<MenuItem Header = "Menu item 1"/>
<MenuItem Header = "Menu item 2"/>
<MenuItem Header = "Menu item 3"/>
</ContextMenu>
</Grid.ContextMenu>
........
........
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
The problem is that the ContextMenu will only open when clicking on the actual context of the Grid, I want to be able to open the menu by clicking anywhere on the Listbox item.
Should I wrap the Grid in some other control?