I want to add a Reports menu to the main menu of the main window of my application. I added a new MainMenuItem and it shows just fine, although it is empty. What I can't figure out how to do is make the items in that menu come from a SingleChoiceAction. I created a controller with a SingleChoiceAction and added all the reports I need run. I then set its Category to "Tools", which made it show up under the Tools MainMenuItem. "Reports" was not a choice in the drop-down. When I just typed in "Reports", the SingleChoiceAction showed up in the toolbar, as opposed to the main menu. Looking at CustomMainForm.cs, it seems that setting SingleChoiceAction.Category="Reports" makes it go into the existing Reports ActionContainerBarItem, instead of the desired, newly created MainMenuItem. So, how do I make the items from the SingleChoiceAction show up in the main menu, instead of the toolbar?
Also, I am having problems populating the items of the SingleChoiceAction. How can I get a list of the reports in the database to add them to the action? ObjectSpace.GetObjects<ReportData>() gives me the report names, but my reports are custom, and I need one of the custom properties I added, called Category. ObjectSpace.GetObjects<CustomXafReport>() and even ObjectSpace.GetObjects<XafReport>() fail with a "Cannot resolve ClassInfo" exception. ObjectSpace.GetObjects(typeof(CustomXafReport)) returns null.
Adding a dynamic Reports menu to the main window menu
Answers approved by DevExpress Support
Hello Steven,
To display actions in a custom menu item, it is required to add specific bar items to the necessary templates (e.g. MainForm and DetailViewForm). Please see what item types are added to these templates by default. It is required to add items that can be used as action containers, e.g. ActionContainerBarItem. A list of these items is provided here: Template Customization. Then, specify the ContainerID of these items and set the Category of your actions to the same values. For example, if you create a new ActionContainerBarItem and set its ContainerID to MyReports, set the Category of your reports-related actions to MyReports as well.
I have created a separate ticket for your second question: How to obtain a list of my custom reports. We will post our answer soon.
For quick and efficient responses, we kindly request that future tickets cover one issue at a time. Your time and cooperation are appreciated.