【问题标题】:devexpress wpf gridcontrol disable context menudevexpress wpf gridcontrol 禁用上下文菜单
【发布时间】:2016-01-28 16:40:44
【问题描述】:

我有一个 DevExpress 网格控件,我想禁用在我右键单击网格列标题时出现的默认上下文菜单。为了禁用这个功能,我处理了PreviewMouseRightButtonDownPreviewMouseRightButtonUp

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

这不是一个可接受的解决方案。网格控制上应该有一些东西。

【问题讨论】:

    标签: wpf devexpress gridcontrol


    【解决方案1】:

    请设置TableView.IsColumnMenuEnabled 属性以控制最终用户右键单击列标题时是否显示列上下文菜单。
    您可以在此处阅读有关所有可用 DXGrid 上下文菜单及其自定义的更多信息:Context Menus

    【讨论】:

      【解决方案2】:

      在您的 TableView 上设置 IsColumnMenuEnabled="False"。

      【讨论】:

        【解决方案3】:

        如果你想禁用特定的上下文菜单项,你可以通过绑定来管理它

         <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}"/>
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-10-27
          • 2011-03-18
          • 1970-01-01
          • 1970-01-01
          • 2013-12-03
          • 1970-01-01
          相关资源
          最近更新 更多