Question

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.

Était-ce utile?

La solution

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

Autres conseils

Set IsColumnMenuEnabled="False" on your TableView.

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}"/>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top