Search This Blog

Wednesday, October 5, 2016

How to place all nested View commands into the main ribbon and activate them based on the selected layout tab

My next two posts will be devoted to advanced ribbon menu customizations in WinForms, which become much easier to implement with the introduction of the new Ribbon and Standard templates (WinApplication.UseOldTemplates = False) back in v14.2 and also API changes in the recent XAF versions.

The current post is about mapping ALL Actions from the nested Frame toolbar into the main ribbon menu by creating a separate page. It is planned that when you activate a certain nested ListView within a layout tab, its related View commands will be activated in a separate ribbon page as well (context-dependent commands). This somewhat exotic approach was requested a few times by different customers and is likely dictated by users who have a habit of using only the main ribbon menu, i.e., without moving the mouse to the bottom context.

The two pictures showing how it was before and after making necessary code changes + a video showing everything in action are worth a thousand words in communicating this effect in the real app.
Context-dependent Actions in ribbon


Standard Actions toolbar in a nested ListView
If you are interested in achieving a similar effect in your own app, download and research the Controller code we attached to this Support Center ticket.
The MoveToolBarItemsToRibbonController_refactored.cs file is to be copied into the SolutionName.Module.Win project and will require the DevExpress.XtraBars and DevExpress.XtraLayout assembly references for compiling. All UIType modes supported by the ribbon menu have been tested with this code using our demo. 

Even though this is not complete solution, which should be modified and tested further based on your real scenarios, I hope it will help you see the great opportunities for customizing a ribbon structure programmatically. If you prefer doing things via the designer, then checking this online documentation article will be a good starting point for you.

Please let me know in comments how you feel about the implemented UI from the usability point of view and whether your end-users have ever asked for something similar in the past.






No comments:

Post a Comment