You can use ListActions in a ViewModel selfVM context to retrieve the actions available for a nesting and use their metadata when you create a custom action display in the UI.
Purpose
ListActions returns a collection of ActionInstance values for the specified nesting. Each value describes one available action, including its name, enabled state, grouping, hint text, and whether it navigates to another ViewModel.
Use ListActions when the standard action presentation does not meet your UI requirements and you need to inspect the actions that the ViewModel makes available.
Argument
| Argument | Type | Description |
|---|---|---|
nameofNesting
|
String | The name of the ViewModel nesting whose available actions you want to retrieve. |
Use selfVM.Nesting to provide the nesting name. This retains error checking if the nesting is renamed. Avoid entering a literal nesting name when selfVM.Nesting is available.
Return value
ListActions returns Collection(ActionInstance): one ActionInstance for each action available on the specified nesting.
For example, a custom UI can inspect each returned item and show its ActionName as the label, its Hint as hover text, and use Enabled to determine whether the UI control is enabled. An action with Enabled set to false can still provide a hint that explains its state.
ActionInstance attributes
| Attribute | Type | Description |
|---|---|---|
ActionName
|
String | The name of the action. |
Enabled
|
Boolean | true when the action is enabled.
|
Group
|
String | The name of the menu group for the action. |
Hint
|
String | Extra information shown when the pointer is over the action UI widget. A hint is available for both enabled and disabled actions. |
IsNavigating
|
Boolean | true when the action navigates to another ViewModel.
|
NestingName
|
String | The name of the ViewModel nesting that owns the action. |
Presentation
|
String | The string representation of the ViewModel. |
Use the action metadata in a custom display
- Identify the nesting whose actions you want to present.
- Retrieve its available actions with ListActions, using
selfVM.Nestingfor the nesting reference where applicable. - Iterate over the returned
ActionInstancecollection in your custom UI logic. - Display
ActionNameand group actions byGroupwhen your UI uses menus or grouped commands. - Bind the action control's enabled state to
Enabled. - Show
Hintfor both enabled and disabled controls so users can receive information about an unavailable action. - Treat actions where
IsNavigatingistrueas actions that open or move to another ViewModel.
Related action operators
Use CanExecuteAction when you need a Boolean check for whether one named action can run in a named nesting. ListActions instead returns the available actions and their UI-related metadata.
