Skip to main content
.NET 6.0+

ActionControlsSiteController.CustomizeActionControl Event

Occurs when an Action control is created.

Namespace: DevExpress.ExpressApp.SystemModule

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public event EventHandler<ActionControlEventArgs> CustomizeActionControl

Event Data

The CustomizeActionControl event's data class is DevExpress.ExpressApp.SystemModule.ActionControlEventArgs.

Remarks

Important

This event is designed to support the internal XAF infrastructure and should not be handled in your code. Use the ActionBase.CustomizeControl event instead.

Below is an example of how to handle this event to customize the created control properties.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.XtraBars;
using DevExpress.XtraEditors.Repository;
// ...
public class CustomizeActionControlController : WindowController {
    protected override void OnActivated() {
        base.OnActivated();
        Frame.GetController<ActionControlsSiteController>().CustomizeActionControl +=
            ActionControlsSiteController_CustomizeActionControl;
    }
    protected override void OnDeactivated() {
        Frame.GetController<ActionControlsSiteController>().CustomizeActionControl -=
           ActionControlsSiteController_CustomizeActionControl;
        base.OnDeactivated();
    }
    private void ActionControlsSiteController_CustomizeActionControl(object sender, ActionControlEventArgs e) {
        if (e.ActionControl.ActionId == "MyDateFilter") {
            BarEditItem barItem = (BarEditItem)e.ActionControl.NativeControl;
            barItem.Width = 170;
            RepositoryItemDateEdit repositoryItem = (RepositoryItemDateEdit)barItem.Edit;
            repositoryItem.Mask.UseMaskAsDisplayFormat = true;
            repositoryItem.Mask.EditMask = "yyyy-MMM-dd";
        }
    }
}

Tip

If you need to create an alternate control rather than customize the default control’s properties, handle the ActionControlsSiteController.CustomAddActionControlToContainer and ActionControlsSiteController.CustomBindActionControlToAction events instead.

See Also