I am trying to persist QAT items. I've been running into two issues (so far):
1. When using the following markup:
<r:XamRibbon.QuickAccessToolbar> <r:QuickAccessToolbar> <r:QuickAccessToolbar.ItemTemplate> <DataTemplate> <r:QatPlaceholderTool TargetId="{Binding}" /> </DataTemplate> </r:QuickAccessToolbar.ItemTemplate> </r:QuickAccessToolbar> </r:XamRibbon.QuickAccessToolbar>
and code:
ribbon.QuickAccessToolbar.ItemsSource = settings.QuickAccessItems;
I'm getting UnsupportedOperationException with the message:
Item of type 'System.String' cannot be added directly to the QuickAccessToolbar. [...]
2. When attempting to restore a group, I'm getting UnsupportedOperationException with the message:
An item with the specified TargetId 'GroupId' being added to the QuickAccessToolbar is not registered with the associated XamRibbon.
Is it me or is it XamRibbon? Is QAT persistence a planned feature? If it is, when will it be available?
Hello,
Could you please tell me if you use the suggested approach for using ObservableCollection<FrameworkElement>. If yes, could you please send me an isolated sample project, where your issue is reproduced, so I can investigate it further for you?
Looking forward for your reply.
My Xamribbon is completely bound to collection of items ObservavbleCollection<Class> . And It apper as a Button tool in RibbonGroup.
When I right I get the "Add to Quick Access ToolBar", but when click on the item i get the error "Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead" How Can i fix it.
As I want to have that Item to be added into the quick access toolbar. Please give us some idea. I am using MVVM in my application.
Any update on my question?
I have one more question on XamRibbon.
Hello again,
The XamRibbon's QAT can only contains QATPlaceHolderTools with set TargetID. If you want to bind the QAT ItemsSource you should use the approach the other user uses with ObservableColelction<FrameworkElement>.
Let me explain you in diff way.
Let say I have a collection of
ObservableCollection<NavigationItem> Navitems WHERE NavigationItem is my Class with property of ID,Name,Description etc. I would like to Bind this collection to igRibbon:QuickAccessToolbar.This is my Style of the Code...
<Style TargetType="{x:Type igRibbon:QuickAccessToolbar}"> <Setter Property="ItemTemplate" Value="{StaticResource Local_DefaultQuickAccessToolbarTemplate}" /> <Setter Property="ItemsSource" Value="{Binding Navitems }"/> <!--<Setter Property="Visibility" Value="{Binding IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />--> </Style>AND this is my DATATEMPLATE
<DataTemplate x:Key="Local_DefaultQuickAccessToolbarTemplate" > <!--<igRibbon:ToolHorizontalWrapPanel>--> <igRibbon:QatPlaceholderTool igRibbon:RibbonGroup.MaximumSize="ImageAndTextLarge" TargetId="{Binding Name}" TargetType="Tool" /> <!--</igRibbon:ToolHorizontalWrapPanel>--> </DataTemplate>Code giving me error, when my collection is getting updated with adding one items..Item of type 'NavigationItem' cannot be added directly to the QuickAccessToolbar. Only QatPlaceholderTools and SeparatorTools can be added directly to the Qat. To add another tool type to the Qat, add a QatPlaceholderTool with a ToolId that references the actual tool you would like to add.Please help..