Skip to main content
.NET 8.0+

PopupWindowShowAction Class

Represents a Pop-up Window Show Action.

Namespace: DevExpress.ExpressApp.Actions

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

[ToolboxTabName("DX.24.2: XAF Actions")]
public class PopupWindowShowAction :
    ActionBase

Remarks

The PopupWindowShowAction class inherits the basic functionality of Actions from the ActionBase class. Pop-up Window Show Actions are used to invoke a pop-up Window with a specified View and execute custom code when an end-user clicks the accept or cancel button. To specify the View to be displayed, handle the PopupWindowShowAction.CustomizePopupWindowParams event and set the required View to the handler’s CustomizePopupWindowParamsEventArgs.View parameter. An example of using this approach is shown below.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Editors;
using DevExpress.Persistent.Base;
// ...
public class ShowPopupViewController : ObjectViewController<ObjectView, Contact> {
    public ShowPopupViewController() {
        var popupAction = new PopupWindowShowAction(this, "ShowPopup", PredefinedCategory.View);
        popupAction.SelectionDependencyType = SelectionDependencyType.RequireSingleObject;
        popupAction.CustomizePopupWindowParams += PopupAction_CustomizePopupWindowParams;
    }
    private void PopupAction_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e) {
        IObjectSpace objectSpace = e.Application.CreateObjectSpace(typeof(Contact));
        Contact currentObject = objectSpace.GetObject(ViewCurrentObject);
        DetailView detailView = e.Application.CreateDetailView(objectSpace, currentObject);
        detailView.ViewEditMode = ViewEditMode.Edit;
        e.View = detailView;
        e.Maximized = true;
    }
}

In the code above, the new PopupWindowShowAction object is created to invoke a pop-up window for the particular View when the PopupWindowShowAction.CustomizePopupWindowParams event raises. The CustomizePopupWindowParamsEventArgs.Maximized property is set to true, thus the pop-up window will expand to occupy the whole space.

To process end-user clicks on the accept and cancel buttons, handle the PopupWindowShowAction.Execute and PopupWindowShowAction.Cancel events, respectively. Built-in Action Containers display Pop-up Window Show Actions via a button.

To add a Pop-up Window Show Action to a Controller, drag and drop the PopupWindowShowAction item from the XAF Actions section on the Toolbox to the required Controller’s Designer area (see Add an Action that Displays a Pop-Up Window). You can also use the ActionAttribute to convert a business class’ method to an Action that displays a non-persistent object in a popup (see How to: Create an Action Using the Action Attribute).

Note

CodeRush allows you to add Actions and Controllers with a few keystrokes. To learn about the Code Templates for XAF, refer to the following help topic: XAF Templates.

Unlike other Action types, the PopupWindowShowAction does not raise the ActionBase.ProcessCreatedView event. This is because such an Action creates a View before the Executed event is raised.

Implements

Inheritance

See Also