Hello, I would like to save the contents of the Quick Access Toolbar between user sessions, but not the rest of the ribbon toolbars. Currently I have a main form with a ribbon,and several MDI child forms with ribbons.
I am not opposed to homebrewing up a serialization to store just the QAT tools, but I am unsure how to uniquely identify each tool (and which form they came from!) so that I can add them to the QAT upon startup next time.
What pieces of tool data would allow me to do this? How can I add a tool that exists on another form that may not be open when the program is loaded?
Hi,
Can you please let me know how did you save QAT because i have same issue. it keeps QAT only for that session. i need to save it for next time when user logged in.
Thanks
If you are doing custom saving and loading of the QAT, you can control what gets saved and loaded and prevent certain tools from being added to the toolbar during load.
As for preventing certain tools from being added to the QAT, you can handle the UltraToolbarsManager.BeforeToolbarListDropdown event and set ShowQuickAccessToolbarAddRemoveMenuItem.on the event arguments to False. There is also a Tool property on the event arguments if you would like to conditionally hide the menu item based on the tool.
Is it possible to gray out the 'add item to QAT' option in the tools that rest in another menu?
I already succeeded in saving the state wich tools were custom added from ribbon to QAT.
My question now is, can some tools being prevented from added to the QAT?
I have a popupmenutool, with recent items. the popupmenu Should be added to the QAT, but the items within the menu should not being added to the QAT. Only the whole menu with all items...
Is this possible?
I apologize for not answering this post sooner. I had not seen it until now.
The UltraToolbarsManager does not let you save layouts on a per-owner (toolbars, menus, ribbon groups) basis. The only control you have over the saved layout file is whether it contains user customizations or not. You can submit a feature request for this.
If you would like to save things manually, I would suggest iterating the Tools collection of the QuickAccessToolbar and saving each tool. To answer your question of how to uniquely identify each tool, the Key of the tool should suffice. All instance tools that are related will have the same tool type and Key. They will also have a root tool with the same type and Key which has shared settings. This root tool with exist in one of two places: UltraToolbarsManager.Tools collection or UltraToolbarsManager.MergedTools collection. The Tools collection stores root tools defined on the parent and the MergedTools collection stores MdiMergePlaceholderTool and PopupMenuTool instances which were created to host child tools during a merge.
So if you were trying to save tools which came from child Forms, regardless of whether the Form was open at the time of saving or loading, you would need to save out the instance tools from the QuickAccessToolbar as well as the root tools which back them from the appropriate collection on the UltraToolbarsManager.
euving said: Hi, I would also like to know how i can save the controls the user added to the QAT at runtime....
Hi, I would also like to know how i can save the controls the user added to the QAT at runtime....
I assume you are asking about tools the user added at runtime. If that's the case, they would be present in the Tools collection of the QuickAccessToolbar, so if you saved the tools from that collection, you would pick up the user customizations. If this is not what you meant, can you provide some more information?