Ticket Q562542
Visible to All Users

Adding a dynamic Reports menu to the main window menu

created 11 years ago

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.

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

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.

    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.