DataGrid: How to style or disable the default ContextMenu of a Cell

Posted by Nike on Stack Overflow See other posts from Stack Overflow or by Nike
Published on 2010-04-11T12:29:13Z Indexed on 2010/04/11 12:33 UTC
Read the original article Hit count: 263

Filed under:
|
|
|
|

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.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about datagrid