I need to create a menu with a few options so that when you select a record in a datagrid and right click on that record a menu with options for that record will appear.
I need to create a menu with a few options so that when you select a record in a datagrid and right click on that record a menu with options for that record will appear.
To declare a context menu for your GridView add this code to its declaration:
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem Header="Titulo do menu" Click="metodo_a_chamar">
<MenuItem.Icon>
<Image Width="12" Height="12" Source="caminho_da_imagem" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</DataGrid.ContextMenu>
Add a <MenuItem/>
for each item the menu should contain.
See more in documentation .