This example demonstrates how to represent an action via the BarCheckItem. For this purpose, an ActionBase descendant (CheckableSimpleAction) is implemented. This is done because it is required to save the checked state of the action. CheckableSimpleAction uses a custom action item (CheckActionItem), which represents it in the UI via a BarCheckItem. Action item is a connector between the abstract entity Action and a particular UI element. When the form's menu is created, XAF creates action items for all actions placed to this form via action containers. This operation is performed by the BarActionItemsFactory and the ActionControlsSiteController. Since we have implemented a custom action type, it is required to implement a custom BarActionItemsFactory to assign an appropriate action item to actions of this type. The custom BarActionItemsFactory is registered via the custom factory provider (MyBarActionItemsFactoryProvider).
Note that in most cases, it is not required to implement a custom action and action item. It is sufficient to customize the existing action item via the BarActionItemsFactory.CustomizeActionControl event. This approach is demonstrated in the How to: Customize Controls Associated with an Action topic.
An example for ASP.NET is available here: How to create a custom action type with a custom control in Web
Note for versions 14.2, 15.1: Currently, custom action types are not supported in our new form templates. Refer to the How to add a checkbox to the toolbar ticket to learn how to add a BarCheckItem to new templates.
Question Comments
Added By: Alexandre Miller at: 6/19/2016 9:15:31 AM Is this still the same in 16.x? It seems BarActionItemsFactoryProvider.CreateBarActionItemsFactory() is never run.Added By: Alexey (DevExpress Support) at: 6/20/2016 3:18:58 AM
Hello,
I've created a separate ticket on your behalf (T394010: E1977 with version 16.1). It has been placed in our processing queue and will be answered shortly.