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?
I am extremely disappointed that this has yet to be answered.
agreed! I'd like to do the same thing!
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?
Hi,
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?
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
I save them in a XML file, if you save your XML file in the 'Roaming' folder in Windows, they wil persist between different Windows session.
do i answer your question?
Thanks for your reply. Is it possible i can refer your code for save it and load it again next time?
Hello all,
Thank you for providing your feedback about our UltraToolbarsManager, and thanks to Fidura for providing your save/load code. This is a good implementation. I wanted to provide some additional background about our design process for this component.
When using the Ribbon, the QAT is the only thing that is customizable by default. The RibbonCustomizationProvider is required to modify the rest of the Ribbon. This means that, for most use cases, saving the entire toolbar should work.
I discussed this with the lead developer working on the UltraToolbarsManager. The UltraToolbarsManager keeps track of two different types of tools. Root tools belong to the Tools collection of the UltraToolbarsManager, and instance tools belong to the tools collection of a particular toolbar or menu. An instance tool is a specific occurrence of a root tool. The issue with saving just the QAT lies with what action to take if a file was loaded that contained QAT tools which don't exist in the root tools collection. It isn't ideal to skip over these tools because they are clearly intended to be there, and adding them doesn’t seem valid since the backing event handler code for the tool would still not exist. We avoid this issue by enforcing that all the tool information stays together.
If you would like to see a feature to load and save just the QAT in the Toolbars Manager, I recommend submitting this as a product idea. If the idea has enough support from our users, we will work together with the community to figure out the most desirable way to implement this. You can suggest new product ideas for future versions on our ideas site.
Remember when submitting your idea to explain the context in which a feature would be used and why it is needed as well as anything that would prevent you from accomplishing this today. You can even add screenshots to build a stronger case.
Thank you in advance for submitting your product idea.
For anyone on this thread, please let me know if you have further questions.
So disappointing that we have to do this ourselves.. surely the QAT is the first (and probably only) thing that everybody wants to save.
We have the same issue here - want to save the QAT without losing the ability to add new buttons
you can loop through your ribbon collection of type: Infragistics.Win.UltraWinToolbars.QuickAccessToolbar. i save the info in 2 arrays (keys, values).
you save them in a XML file
While (teller < toolbar.Tools.Count) keys(i) = "QAT" + CStr(teller) + " " + "Setting" values(i) = toolbar.Tools(teller).Key teller += 1 i += 1 End While
When you have to load them, get your settings from the xml file and reinsert the tools in QAT. 'Str' are my xmlSettings. 'Toolbar' is my Infragistics.Win.UltraWinToolbars.QuickAccessToolbar
While (teller < str.Count) Dim key As String = "QAT" & teller + 1 & " Setting" toolbar.Tools.AddTool(str(key)) teller += 1 End While