Add Actions to a Pop-up Window
- 3 minutes to read
A pop-up Window contains a View (Detail or List View) and Actions, like any other Window. The Actions are displayed by the Action Containers of the Window’s Template. If you need to add an Action to a pop-up Window, you should add it to the Action Container of the appropriate Template. This topic details what built-in Templates are used to display pop-up Windows, and how to add Actions to their Action Containers. To learn how to display a window (a pop-up or not) from an Action, refer to the Ways to Show a View topic.
The following built-in Templates are used to display pop-up Windows:
Template name | Description | Action Containers |
---|---|---|
LookupForm | Used in Windows Forms applications for pop-up Windows with List Views. Contains a nested FrameTemplate which actually displays a View and Actions. | The “ObjectsCreation” and “PopupActions” Action Containers of the ButtonsContainer type. |
PopupForm | Used in Windows Forms applications for pop-up Windows with Detail Views. | The “PopupActions” Action Container of the ButtonsContainer type. If you assign this Template to a Window with a List View, it will contain a context menu with the following Action Containers: “ObjectsCreation”, “RecordEdit”, “View”, “Print”, and “Export”. |
Dialog | Used in ASP.NET Web applications for pop-up Windows with any View. | The “ObjectsCreation”, “Search”, “FullTextSearch”, “PopupActions” and “Diagnostic” Action Containers of the HorizontalActionContainer type. |
The ButtonsContainer Action Container displays all Action types as a button. However, the button’s Click event is handled in different ways for different Action types:
-
The Action’s SimpleAction.Execute event is raised.
-
A pop-up Window which is specified in the Action’s PopupWindowShowAction.CustomizePopupWindowParams event handler is invoked.
-
A drop down pop-up menu with items specified by the Action’s ChoiceActionBase.Items property is invoked.
-
An exception is raised because the Action Container does not support this Action type.
Action Containers get Actions for display from the Application Model’s Application | ActionDesign | ActionToContainerMapping | ActionContainer node. For instance, a “PopupActions” ActionContainer gets Actions from the … | ActionToContainerMapping | PopupActions node. So, add the required Action to the appropriate Action Container to display it in a pop-up Window. To do this, use one of the following techniques:
In code
Specify the Action’s ActionBase.Category property. This property is considered when information on the Action is loaded to the Application Model’s ActionDesign node.
Tip
A complete sample project is available in the DevExpress Code Examples database at How to add custom buttons ( Actions ) to the lookup and popup windows?.
Additionally, you can to customize the action-to-container mapping dynamically using the ActionControlsSiteController.CustomizeContainerActions event.
Manually in the Model Editor
Drag and drop the Action to the required ActionDesign | ActionToContainerMapping | ActionContainer node (see Place an Action in a Different Location).
If you need to add an additional Action Container to a Template which is used to display pop-up Windows, customize this Template. For details, refer to the Template Customization and How to: Create a Custom WinForms Ribbon Template topics.