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?
I was able to work around the first issue as well by using:
<r:XamRibbon.QuickAccessToolbar> <r:QuickAccessToolbar ItemsSource="{Binding QuickAccessToolbarItems}" /> </r:XamRibbon.QuickAccessToolbar>
and creating the QuickAccessToolbarItems as ObservableCollection<FrameworkElement> (since in addition to QatPlaceholderTools it may contain SeparatorTools).
I would like to understand your solution. Can you please post more about your solution.
I am trying to use also Binding as posted by you, but I was not able to make is work.
This is how my XAML looks like:
<igRibbon:XamRibbon.QuickAccessToolbar >
<igRibbon:QuickAccessToolbar ItemsSource="{Binding Path=QatItems}"
</igRibbon:QuickAccessToolbar>
</igRibbon:XamRibbon.QuickAccessToolbar>
This is how my property in my viewmodel looks like
public ObservableCollection<FrameworkElement> QatItems
{
get
return qatItems;
}
set
qatItems = value;
This os the error i get.
Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead.
Thanks
Wow, it's been almost a full year!
I have since abandoned binding in favor of Prism. I brought NCAL up to date with Prism 2.x and added region adapters for XamRibbon parts, including QAT. All QatPlaceholderTools and SeparatorTools are now mirrored by views, and an elaborate method for determining the target type by id is used.
can u post your refreshed version of ncal, perhaps on SkyDrive or anywhere else?
I just sent an email to Infragistics asking to add me as contributor to the CodePlex project. I'll check in the updated sources as soon as they do.
Dmitry