0
I need to create a menu with some options so that when a record is selected on a datagrid and right-click on this record a menu with the options for that record appears.
0
I need to create a menu with some options so that when a record is selected on a datagrid and right-click on this record a menu with the options for that record appears.
2
To declare a context menu for your Gridview add that code to her statement:
<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 on documentation.
Ball show in helping as always.Thanks @ramaral
how do I make the menu appear when I select just one row? Because my option will be according to the selected line (in this case I just want to add the option to delete only).
To answer, I would have to do some tests, I imagine how this can be done, but I don’t have an answer ready. I suggest you create a new question, so other people can also answer.
I asked another question, anyway, thank you very much!
When I have time and if no one answers, I’ll answer.
Browser other questions tagged c# wpf
You are not signed in. Login or sign up in order to post.
Yes and what is your doubt?
– ramaral
How to create this menu @ramaral
– Leomar de Souza