Back to Devexpress

Add a Simple Action

expressappframework-402157-getting-started-in-depth-tutorial-blazor-add-actions-menu-commands-add-a-simple-action.md

latest2.9 KB
Original Source

Add a Simple Action

  • Nov 27, 2025
  • 3 minutes to read

This lesson explains how to create a Simple Action — a button that executes custom code when a user clicks it.

The instructions below demonstrate how to add the Clear tasks button to the Employee Detail View. A click on this button clears all Tracked Tasks of the selected Employee.

Note

Before you proceed, take a moment to review the previous lessons:

Step-by-Step Instructions

  1. Add a View Controller. In the Solution Explorer , right-click the Controllers folder in the MySolution.Module project and choose Add | New Item… In the opened dialog, select DevExpress 25.2 Template Kit , specify ClearContactTasksController as the new item’s name, and click Add. In the XAF platform section, select XAF Controllers | View Controller and click ADD ITEM.

  2. Visual Studio displays an autogenerated ClearContactTasksController.cs file with a single View Controller declaration. In the controller constructor, specify the controller properties:

  3. Add a new action to the controller and a handler for the action’s Execute event:

  4. Run the application.

You can display an action’s button in a Detail View layout instead of a toolbar. Refer to the following topic for more information: How to: Include an Action in a Detail View Layout.

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.

Next Lesson

Add a Parametrized Action

See Also

Controllers (UI Logic & Interaction)

Actions (Menu Commands)

SimpleAction