expressappframework-402159-getting-started-in-depth-tutorial-blazor-add-actions-menu-commands-add-an-action-with-option-selection.md
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:
Add a new View Controller to the MySolution.Module project. Name it TaskActionsController.
In the TaskActionsController.cs file, set the controller’s TargetObjectType:
Add a SingleChoiceAction and specify its properties:
To populate the Action with items, fill the Action’s ChoiceActionBase.Items collection in the Controller’s constructor:
Open the DemoTask.cs file and assign images to the Priority enumeration value as in the code sample below:
Handle the SingleChoiceAction.Execute event that occurs when a user chooses the Action’s item:
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.
Add a Simple Action Using an Attribute
See Also
Create, Read, Update and Delete Data