Hi,
I'd like to save 'shortcuts' added by users in the Quick Access Toolbar between sessions, in order to reload it on startup.
I found many examples for Windows forms, but mentioned methods (Ribbon.savesettingstostream, ribbon.savetoXML) seems not to be implemented in WPF.
Does anybody know how to do?
thanks
Hello Lionel,
I managed to solve your issue by creating two methods for loading and saving Quick Access Toolbar’s content into XML file.
I created and attached a sample application for the described above.
Please let me know if this is what you needed and if you require any further assistance on the matter
Sincerely,
Krasimir
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support
Hello Krasimir,
I tried the mechanism from your sample in my application, where the ribbon is filled at runtime.
In the first try, I got exceptions like these all the time:
UnhandledException: System.InvalidOperationException: An item with the specified TargetId 'XYZMYITEMKEY' being added to the QuickAccessToolbar is not registered with the associated XamRibbon. at Infragistics.Windows.Ribbon.QatPlaceholderTool.VerifyAssociatedTool() in e:\Work\2\242\Sources\RELEASE\XAML\2011.1\Source\Ribbon\Tools\QatPlaceholderTool.cs:line 508 at Infragistics.Windows.Ribbon.QatPlaceholderTool.VerifyAssociatedTarget() in e:\Work\2\242\Sources\RELEASE\XAML\2011.1\Source\Ribbon\Tools\QatPlaceholderTool.cs:line 477 at Infragistics.Windows.Ribbon.QatPlaceholderTool.OnLoaded(Object sender, RoutedEventArgs e) in e:\Work\2\242\Sources\RELEASE\XAML\2011.1\Source\Ribbon\Tools\QatPlaceholderTool.cs:line 390 at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e) at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent) at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root) at MS.Internal.LoadedOrUnloadedOperation.DoWork() at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks() at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
That may be caused by I first put the ButtonTools into the RibbonGroups, the groups into the Tabs and then added the filled tabs into the ribbon.
It has improved after I changed this to:First add tabs, then add groups to tabs, then add items (ToolButtons) to groups.
Now, RibbonGroups and ButtonTools from within the RibbonGroups can properly be added to the QAT and I can save/restore their keys and types.
But still, some items cause the exception above when trying to restore the QAT-Items, as if they were not correctly registered with the ribbon. But I know they are present in the ribbon (just not in the first tab, maybe that's the point?),
Is there any way to make sure that each key is correctly registered with the ribbon?