Aggregated Action. Getting Started

This topic explains how to start using the features provided by the Aggregated Action.

First, add the required modules into the application: XafariModule and, depending on the platform, XafariWinModule or XafariWebModule. The Aggregated Action needs the presence of several initialized Actions of standard types: Simple Action, Popup Window Show Action, and Single Choice Action. For instance, AggregatedActionViewController contains the following Actions: simpleAction1, popupWindowShowAction1, and singleChoiceAction1.

  • c#
  • VB

partial class AggregatedActionViewController
{
  //...
  private void InitializeComponent()
  {
    this.components = new System.ComponentModel.Container();
    DevExpress.ExpressApp.Actions.ChoiceActionItem choiceActionItem1 = new DevExpress.ExpressApp.Actions.ChoiceActionItem();
    DevExpress.ExpressApp.Actions.ChoiceActionItem choiceActionItem2 = new DevExpress.ExpressApp.Actions.ChoiceActionItem();
    DevExpress.ExpressApp.Actions.ChoiceActionItem choiceActionItem3 = new DevExpress.ExpressApp.Actions.ChoiceActionItem();
    this.simpleAction1 = new DevExpress.ExpressApp.Actions.SimpleAction(this.components);
    this.popupWindowShowAction1 = new DevExpress.ExpressApp.Actions.PopupWindowShowAction(this.components);
    this.singleChoiceAction1 = new DevExpress.ExpressApp.Actions.SingleChoiceAction(this.components);
    //...
  }
  //...
}

Friend Partial Class AggregatedActionViewController
  '...
  Private Sub InitializeComponent()
    Me.components = New System.ComponentModel.Container()
    Dim choiceActionItem1 As DevExpress.ExpressApp.Actions.ChoiceActionItem = New DevExpress.ExpressApp.Actions.ChoiceActionItem()
    Dim choiceActionItem2 As DevExpress.ExpressApp.Actions.ChoiceActionItem = New DevExpress.ExpressApp.Actions.ChoiceActionItem()
    Dim choiceActionItem3 As DevExpress.ExpressApp.Actions.ChoiceActionItem = New DevExpress.ExpressApp.Actions.ChoiceActionItem()
    Me.simpleAction1 = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
    Me.popupWindowShowAction1 = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
    Me.singleChoiceAction1 = New DevExpress.ExpressApp.Actions.SingleChoiceAction(Me.components)
    '...
  End Sub
  '...
End Class

Note

You can view the code used in this lesson in the Xafari.FeatureCenter|Actions|AggregatedActionViewController.cs file of the Feature Center demo installed with Xafari. By default, the Feature Center application is installed in %PUBLIC%\Documents\Xafari Framework vXX.X.XXXX Demos\Feature Center.

After the initial setup, it is possible to follow one of the scenarios below:

  1. The first option is to create a custom instance of the Xafari.Actions.AggregatedAction class in the appropriate Controller. This manipulation can be done either via the Controller Designer or in code. The Feature Center demo contains the following objects as examples: WizardTemplatesActions, WizardImplementationsActions, and ManagedOperations.
  2. The other way is to use the ActionsAggregatedAction object provided by the Xafari.BC module. First of all, the Xafari.BC module should be added to the project in order to provide the required functionality. This scenario is described in details further. The code snippet below shows the ActionsAggregatedAction declaration:
  • c#
  • VB

namespace Xafari.BC.Controllers
{
  public partial class DeclareActionsActionWindowController : Controller
  {
    //...
    private Actions.AggregatedAction actionsAggregatedAction;
    //...
    private void InitializeComponent()
    {
      //...
      this.actionsAggregatedAction = new Xafari.Actions.AggregatedAction(this.components);
      //...
    }
  }
}

Namespace Xafari.BC.Controllers
  Public Partial Class DeclareActionsActionWindowController
    Inherits Controller
    '...
    Private _actionsAggregatedAction As Actions.AggregatedAction
    '...
    Private Sub InitializeComponent()
      '...
      Me._actionsAggregatedAction = New Xafari.Actions.AggregatedAction(Me.components)
      '...
    End Sub
  End Class
End Namespace

Then we have to build the project/solution. All the Aggregated Actions declared in the custom code or in the referenced modules are added to the Application Model:

aggregated_action_2

The Aggregated Action displays several Action Containers in accordance with the specified structure. The containers can be either default or custom.

To map an Action to the custom Action Container, invoke the Model Editor, and navigate to the ActionDesign|ActionToContainerMapping node. Right-click the node and choose the Add|Action Container option in the context menu. For the new item, set its Id property to the "My Actions" value.

Right-click the created ActionDesign|ActionToContainerMapping|My Actions node and choose the Add|ActionLink option. For the new Action Link, set its Action property to "popupWindowShowAction1". Add simpleAction1 and singleChoiceAction1 in a similar way.

aggregated_action_3  

Add two more Action Containers (First and Second) as shown in the image above.

Now we will use the Aggregated Action to group the Action Containers into a single menu item in accordance with the needs of the application. The structure of the Aggregated Action is built using Categories. A Category can contain links both to other Categories and to the Action Containers.

Navigate to the ActionDesign|AggregatedActions|ActionsAggregatedAction node, set its RootCategory property to the "Diagnostic" value. Diagnostic is an existing Action Container that will be displayed at the top level of the Aggregated Action's menu. Focus the Categories subnode, right-click on it, and choose Add|CategoryLink.

aggregated_action_4

For the new node, set the Category property to "First", and set the IsSubMenu property to "True".

aggregated_action_5

The IsSubMenu property indicates whether or not to display nested Actions within a separate container (i.e. submenu).

aggregated_action_6

Focus the First node, right-click, choose Add|CategoryLink, and add two new Categories (Second and MyActions), as shown in the image below.

aggregated_action_7

The BeginGroup property indicates whether the separator line is present before the appropriate Category in the menu.

aggregated_action_8

The EmptyItemsBehavior property lists the options used to customize the behavior for the situations that involve an empty set of Actions. It is similar to DevExpress.ExpressApp.Actions.ChoiceActionBase.EmptyItemsBehavior.

Now you can build the solution, run the WinForms or ASP.NET application, and see the hierarchical menu provided by the Aggregated Action.

Win

aggregated_action_9

Web

aggregated_action_91