Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

How to: Include an Action to a Detail View Layout

  • 2 minutes to read

In specific scenarios, you may need to place an Action in a View and not a toolbar. In this case, you need to use an Action Container View Item. The Action Container View Item is used to display a particular Action Container in a UI. Use this approach when you need to place an Action on a Detail View or Dashboard View layout. To add a button to a Detail View, execute the following steps.

Tip

A complete sample project is available in the DevExpress Code Examples database at https://supportcenter.devexpress.com/ticket/details/e1847/how-to-include-an-action-to-a-detail-view-layout.

  • Create a Controller, add a Simple Action to it and handle the Action’s Execute event. For a step-by-step guide, refer to the Add a Simple Action tutorial. When running the application, a button will be created to represent the Simple Action. The code implemented in the Execute event handler will be performed when an end-user clicks this button.
  • Create a new Action category by setting the ActionBase.Category to a custom value by selecting the current value text and typing a custom value. For instance, you can set the Action’s category to “MyCategory”. Rebuild your project.

    HT_Add_Button1_1

  • Invoke the Model Editor for your platform-independent Module project and navigate to the required Views | DetailView node (if theModel Editor is already opened, restart it). Add a new ActionContainerViewItem child node to the Detail View’s Items node via the context menu.

    HT_Add_Button1_2

  • Set the newly created node’s Id property to “MyActionContainer” and the ActionContainer property to “MyCategory”.

    HT_Add_Button1_3

  • Focus the Views | DetailView | Layout node. Right-click on an empty space to invoke the layout customization dialog, then place the newly-created control at the required location. For details on how to change the layout, refer to the View Items Layout Customization topic.

    HT_Add_Button1_4

  • Run the application to make sure that the button is added to the required Detail View.

    HT_Add_Button1_5

See Also