59

How does one add a ContextMenu to a DataGrid? I want to be able to right click anywhere on the DataGrid.

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
StillWorking28269
  • 2,201
  • 2
  • 14
  • 6
  • 2
    possible duplicate of [Adding different context menu for datagrid's header](http://stackoverflow.com/questions/2706246/adding-different-context-menu-for-datagrids-header) – Godeke Dec 05 '12 at 17:49

1 Answers1

161
<DataGrid>
    <DataGrid.ContextMenu>
        <ContextMenu>
            <MenuItem Header="Click Me" Click="MenuItem_Click" />
        </ContextMenu>
    </DataGrid.ContextMenu>
</DataGrid>
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
StillWorking28269
  • 2,201
  • 2
  • 14
  • 6