Options menu with right mouse button on datagrid

0

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.

    
asked by anonymous 25.05.2015 / 01:42

1 answer

2

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 .

    
25.05.2015 / 15:34