1
votes

I have a DevExpress grid control and I want to disable the default context menu that appears when I right click the Grid column headers. To disable this functionality I handled the PreviewMouseRightButtonDown and PreviewMouseRightButtonUp

private void UserControl_PreviewMouseRightButtonDown_Up(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            e.Handled = true;
        }

This is not an acceptable solution. There should be should be something on grid control.

3

3 Answers

3
votes

Please set the TableView.IsColumnMenuEnabled property to control whether the column context menu is shown when an end-user right-clicks a column's header.
You can read more about all avilable DXGrid's context menus and its customization here: Context Menus

1
votes

Set IsColumnMenuEnabled="False" on your TableView.

0
votes

If you want disable specific context menu item you can manage it by binding

 <dxb:BarButtonItem Name="contexMenuTransmitPendingClaim"
                                                       Command="{Binding Path=(dxb:GridPopupMenuBase.GridMenuInfo).View.DataContext.TransmitPendingClaimCommand,
                                                                         RelativeSource={RelativeSource Self}}"
                                                       Content="Transmit Pending Claim"
                                                       IsEnabled="{Binding Path=(dxb:GridPopupMenuBase.GridMenuInfo).View.DataContext.SelectedCusHisViewRefillHistory.IsPendingClaimsActive,
                                                                           RelativeSource={RelativeSource Self},
                                                                           Mode=TwoWay,
                                                                           UpdateSourceTrigger=PropertyChanged}"/>