InRibbonGallery PART_ListBox IsSynchronizedWithCurrentItem

Sep 8, 2010 at 9:13 PM


can you set the "IsSynchronizedWithCurrentItem" on the "PART_ListBox" to true or expose it in another way, so that shown collections automatically update?


Sep 9, 2010 at 7:08 PM
Edited Sep 9, 2010 at 10:15 PM

In v1.3 it is not enough to set IsSynchronizedWithCurrentItem to true. In the current version it doesn't show the items from an ObservableCollection<T>.

The InRibbonGallery is populated with an ItemsSource="{Binding Path=ObservableCollection<T>}" from a viewmodel and an ItemTemplate="{StaticResource CoolTemplate}", which is defined in the UserControl.Resources where the Ribbon is hosted.

Whith the following template i can achieve that selecting listbox items changes the active item in the ObservableCollection<T> back from the view model.

<ContentControl Content="{Binding Path=ObservableCollection<T>}"
                         ContentTemplate="{StaticResource GalleryTemplate}"

<HierarchicalDataTemplate x:Key="GalleryTemplate">
  <ListBox ItemsSource="{Binding}"
           ItemTemplate="{StaticResource CoolTemplate}"
        <WrapPanel />