![Avatar](https://secure.gravatar.com/avatar/bbbb0d96dce1c6a68aa453793da84ece.jpg?s=64&d=identicon&r=g)
Hello,
ColorPickerGallery uses SolidColorBrush as its items. That being said, a Red SolidColorBrush might not be the same instance as another Red SolidColorBrush, so setting the ColorPickerGallery.SelectedItem to a Color or a SolidColorBrush instance not defined in the ColorPickerGallery might not allow a related item to be found.
Whereas if you do set the ColorPickerGallery.SelectedItem property to a SolidColorBrush instance that is defined in the gallery, selection updates should work. This example shows the same instances used in a ListBox and as you change selection in the ListBox, it will update the ColorPickerGallery selection:
<ribbon:ColorPickerGallery x:Name="colorGallery" IsPreviewEnabled="True">
<ribbon:ColorPickerGallery.ItemTemplate>
<DataTemplate>
<Rectangle Fill="{Binding BindsDirectlyToSource=True}" Width="20" Height="20" />
</DataTemplate>
</ribbon:ColorPickerGallery.ItemTemplate>
<ribbon:ColorPickerGallery.CategorizedItemsSource>
<x:Array Type="{x:Type SolidColorBrush}">
<SolidColorBrush Color="White" />
<SolidColorBrush Color="Black" />
<SolidColorBrush Color="Red" />
<SolidColorBrush Color="Green" />
<SolidColorBrush Color="Blue" />
</x:Array>
</ribbon:ColorPickerGallery.CategorizedItemsSource>
</ribbon:ColorPickerGallery>
<ListBox x:Name="colorListBox"
ItemsSource="{Binding ElementName=colorGallery, Path=CategorizedItemsSource}"
SelectedItem="{Binding ElementName=colorGallery, Path=SelectedItem, Mode=TwoWay}" />
If you are having trouble getting the SelectedItem you set to be recognized (due to it being a different SolidColorBrush instance), you might have to iterate the ColorPickerGallery.Items and index find the item already in the gallery that matches color and then set that instance to the SelectedItem property.