DataGrid: How to style or disable the default ContextMenu of a Cell
- by Nike
I use DataGrid with DataGridTextColumns. How can I style or disable the default ContextMenu of a Cell? I tried to add a style for DataGridCell:
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="ContextMenu" Value="{x:Null}"/>
</Style>
</DataGrid.CellStyle>
but it doesn't work.
As I understand, it is a TextBox inside a Cell when the Cell in edit mode. I tried also to add a style for TextBox, but it have an effect only on TextBoxes in XAML, but not on the DataGrid cells.