Skip to main content
.NET Framework 4.5.2+

ActionBase.Category Property

Specifies an Action‘s category.

Namespace: DevExpress.ExpressApp.Actions

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

[TypeConverter(typeof(ActionCategoryConverter))]
[DefaultValue("Unspecified")]
public string Category { get; set; }

Property Value

Type Default Description
String "Unspecified"

A String value that represents a Category for the current Action.

Remarks

Use the Action’s Category property to specify the Action Container where XAF displays the current Action. You can specify a predefined category that corresponds to an Action Container used by built-in Templates. These categories are available in the DevExpress.Persistent.Base.PredefinedCategory enumeration.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
// ...
public class CustomViewController : ViewController {
    public CustomViewController() {
        SimpleAction customAction = new SimpleAction(this, "CustomAction", PredefinedCategory.View);
        // or
        customAction.Category = PredefinedCategory.View.ToString();
        // or 
        customAction.Category = "View";
        // or 
        customAction.Category = "MyCustomCategory";
    }
}

The Category property is set to DevExpress.Persistent.Base.PredefinedCategory.Unspecified (the default setting). You can specify a different value in the Controller’s constructor or Designer. XAF saves this value to the Application Model‘s ActionDesign | Actions | <Action> node. You can change this value in the Model Editor (see How to: Place an Action in a Different Location and How to: Reorder an Action Container’s Actions Collection).

In the UI, XAF displays the value specified in the Application Model’s .xafml file that was loaded last. For more information about the load order of Application Model differences, refer to the following topic: Application Model Basics.

If the Category property is set to Unspecified, XAF displays the Action in the current Template‘s DefaultContainer.

Note

A Template may return null for this property. We recommend that you explicitly assign the required category to the Action’s Category property.

How to Add an Action to a Context Menu or Command Column

You can use Action Containers that appear in Context Menus only. If you want to show an Action only in a Context Menu (in ASP.NET Core Blazor and Windows Forms), specify the Menu category.

If you want to show a SimpleAction only in a List View grid column (in ASP.NET Core Blazor and ASP.NET Web Forms), specify one of the following Action Container IDs in the Action’s Category property:

  • ListView
  • Edit
  • RecordEdit

For instructions on how to display an Action in a List View grid, refer to the following topic: How to: Add a Grid Column with an Action (ASP.NET Core Blazor and ASP.NET Web Forms).

To see where a certain Action Container is located, add a custom template to your application and open it in the Designer.

The layout of Action Containers in an XAF ASP.NET Core Blazor UI is described in the following topic: Action Containers.

List View context menus generally do not display Actions mapped to the Unspecified category. These Actions only appear in Windows Forms applications that use the TabbedMDI or StandardMDI UIType.

To see how Actions are mapped to Action Containers in your application, open the ActionDesign | ActionToContainerMapping node in the Model Editor.

See Also