Back to Devexpress

Add an Action with Option Selection

expressappframework-402159-getting-started-in-depth-tutorial-blazor-add-actions-menu-commands-add-an-action-with-option-selection.md

latest2.8 KB
Original Source

Add an Action with Option Selection

  • Feb 16, 2023
  • 4 minutes to read

This lesson explains how to create an Action that supports option selection.

In this lesson, you will implement a new View Controller with a SingleChoiceAction. This action will allow users to select values for the Task.Priority and Task.Status properties.

Note

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

Step-by-Step Instructions

  1. Add a new View Controller to the MySolution.Module project. Name it TaskActionsController.

  2. In the TaskActionsController.cs file, set the controller’s TargetObjectType:

  3. Add a SingleChoiceAction and specify its properties:

  4. To populate the Action with items, fill the Action’s ChoiceActionBase.Items collection in the Controller’s constructor:

  5. Open the DemoTask.cs file and assign images to the Priority enumeration value as in the code sample below:

  6. Handle the SingleChoiceAction.Execute event that occurs when a user chooses the Action’s item:

  7. Run the application. Select the Task item in the navigation control. After that, the Set Task Action becomes active.

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 Simple Action Using an Attribute

See Also

Create, Read, Update and Delete Data

CommitChanges()

Add and Replace Icons

Controllers (UI Logic & Interaction)

SingleChoiceAction

Actions (Menu Commands)