Skip to main content
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ActionControlsSiteController.CustomizeContainerActions Event

Occurs when Actions are added to the Action Containers according to the information specified in the ActionDesign | ActionToContainerMapping Application Model node.

Namespace: DevExpress.ExpressApp.SystemModule

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

#Declaration

public event EventHandler<CustomizeContainerActionsEventArgs> CustomizeContainerActions

#Event Data

The CustomizeContainerActions event's data class is DevExpress.ExpressApp.SystemModule.CustomizeContainerActionsEventArgs.

#Remarks

Handle the CustomizeContainerActions event to customize the action-to-container mapping in code, without making changes in the Application Model. To do the same for Templates that does not support the IActionControlsSite interface, additionally handle the FillActionContainersController.CustomizeContainerActions event. The following code demonstrates how to remove the SaveAndNew Action from the Save container and add it to the Edit container:

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.ExpressApp.Win.Templates.Bars.ActionControls;
// ...
public class CustomizeContainerActionsController : Controller {
    protected override void OnActivated() {
        base.OnActivated();
        Frame.GetController<ActionControlsSiteController>().CustomizeContainerActions += OnCustomizeContainerActions;
        Frame.GetController<FillActionContainersController>().CustomizeContainerActions += OnCustomizeContainerActions;
    }
    protected override void OnDeactivated() {
        Frame.GetController<ActionControlsSiteController>().CustomizeContainerActions -= OnCustomizeContainerActions;
        Frame.GetController<FillActionContainersController>().CustomizeContainerActions -= OnCustomizeContainerActions;
        base.OnDeactivated();
    }
    private void OnCustomizeContainerActions(object sender, CustomizeContainerActionsEventArgs e) {
        ActionBase actionToBeMoved = e.AllActions.Find("SaveAndNew");
        if ((actionToBeMoved != null) && (e.Category == "Save") && (e.Container is BarLinkActionControlContainer)) {
            e.ContainerActions.Remove(actionToBeMoved);
        }
        if ((actionToBeMoved != null) && (e.Category == "Edit")) {
            e.ContainerActions.Add(actionToBeMoved);
        }
    }
}

The result is demonstrated in the image below:

ActionControlsSiteController_CustomizeContainerActions

See Also