Skip to content

Latest commit

 

History

History
48 lines (29 loc) · 2.88 KB

File metadata and controls

48 lines (29 loc) · 2.88 KB

XAF - How to execute Actions programmatically

This example shows how to trigger the code inside Execute event handlers of custom or standard XAF Actions. For example, you can programmatically invoke an Action that shows a View or runs code in the background.

NOTE We do not recommend this approach. Refactor your Action's event handlers and extract the code into separate methods. Call these separate methods directly without triggering UI-related Action code.

image

Implementation Details

SimpleAction

mySimpleAction.DoExecute();

ParametrizedAction

myParametrizedAction.DoExecute("test value");

Make sure that the parameter type matches ParametrizedAction.ValueType. A string is used in this example.

SingleChoiceAction

mySingleChoiceAction.DoExecute(mySingleChoiceAction.Items[0]);

Make sure you pass a parameter that is a valid item from SingleChoiceAction.Items. This example passes the first item in the collection.

PopupWindowShowAction (Display a Dialog Window)

We do not provide public API to execute a PopupWindowShowAction. Use the ShowViewStrategyBase.ShowViewInPopupWindow(View, Action, Action, String, String) method to show a View in a pop-up window.

Files to Review

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)