문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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}"/>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top