从 DetailView 中隐藏 SimpleAction

Hide SimpleAction from DetailVIew

我在 'myclass' 中有一个简单的操作,我希望在修改特定 属性 时隐藏它 这是我的代码示例:

     protected override void OnActivated()
            {
                base.OnActivated();
                ObjectSpace.ObjectChanged += ObjectSpace_ObjectChanged;
            }



   void ObjectSpace_ObjectChanged(object sender, ObjectChangedEventArgs e)
    {
         if( e.PropertyName == "PropertyName")
              {
                  if (PropertyName  == "A")
                  {
                      // Hide or Desactivate my SimpleAction
                  }
                 else
                  {
                // Show or Actived my SimpleAction
                  }

            }
    }

我怎样才能完成这个任务?

对于此类常见问题,您应该首先搜索 DevExpress 支持中心。例如对于这个查询 https://search.devexpress.com/?q=hide%20action%20ObjectMethodActions&m=SupportCenter 你可以得到这个 Approved solution

As described in the How to: Create an Action Using the Action Attribute article, actions declared using the Action attribute are collected by the ObjectMethodActionsViewController controller. So, you can create a view controller, access an ObjectMethodActionsViewController instance in your view controller, and hide the required action as described in the How to: Deactivate (Hide) an Action in Code article. You can find your action in the ObjectMethodActionsViewController Actions collection by the action ID. According to the How to: Create an Action Using the Action Attribute article, your ID will be your business class name and the method name separated by a dot.