Ticket S134617
Visible to All Users

How to map Actions to a certain RibbonPage and RibbonGroup using the Application Model or in code

created 15 years ago

With reference to question: http://www.devexpress.com/issue=B147367, I would like to suggest this be added to XAF as standard.
Proposed Solution:
The following modification to the XAF application model should be done:
Add the following properties to the model: TargetRibbonPage and TargetRibbonGroup properties to Action items so that these can be specified in the model.
The ActiontoContainerMapping should also have a TargetRibbonPage property where a group for this mapping will be placed.
These properties SHOULD apply to all available actions and ActiontoContainerMappings.
When generating the Ribbonbar, it would then be simple enough to read each action and place it on the corresponding ribbon page. The benefits of this is that developers will now have full control over where items are placed on the ribbon bar, allowing them to fully customize thier ribbon without the need to write a single line of code.
This can also be extended to items placed on the Navigation bar. By specifying these two additional properties for the navigationitem attribute, developers can choose whether they want the items on the standard navigation bar or if they would like them placed on the ribbon bar (if the TargetRibbonxxx properties of the navigationitem attribute are null they go on the navigation bar else ribbon bar on page and group specified)
I strongly believe this will be an easy modification for XAF to implement and the benefit derived from it will make a huge difference for developers when it comes to customizing an already great framework.

Answers

created 15 years ago (modified 8 years ago)

For 15.1+ with the new WinForms templates:
See two possible solutions for accomplishing this task:
1.  RibbonFromModelWithEventController.cs
It handles the ActionControlsSiteController.CustomizeContainerActions event to move marked Actions from the original Action Container (IModelAction.Category) into another container specified in the TargetRibbonGroup property via the IModelAction interface extension. Note that the universal BarLinkActionControlContainer class is used instead of the RibbonGroupActionControlContainer one, because starting with v15.1, our XtraBars library got the RibbonControl.AllowInplaceLinks feature.

2.  RibbonFromModelWithoutEventController.cs
This approach is very similar to the first one, except for using the Model Editor instead of the ActionControlsSiteController.CustomizeContainerActions event as shown in the attached video (RibbonFromModelWithoutEventController_demo.swf).

For older versions with the old WinForms templates:
You can use a solution shown in the RibbonFromModelController.cs file attached to the no ribbontemplates node issue.
See Also:  Allow Toolbars customization from Model and End User Interface and Customize Ribbon via Model

Thanks,
Dennis

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.