This is a migrated thread and some comments may be shown as answers.

How to refresh StandardPaletteItemsSource

1 Answer 63 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Terry asked on 02 Aug 2010, 05:31 AM

I have a collection of custom colors:
private Collection<Color> CustomColors = new Collection<Color>();
I have a color picker:
<telerikRibbonBar:RadRibbonDropDownButton x:Name="btnFillColorPicker" Background="White" Width="26" 
    telerikRibbonBar:ScreenTip.Title="Select Fill Color" 
    telerikRibbonBar:ScreenTip.Description="When you click the bucket button, the selected color will be used to fill the selected object." 
    HorizontalAlignment="Center" Click="BackgroundColor_Button_Click">
        <telerikInput:RadColorSelector x:Name="FillColor_Selector" Loaded="RadColorSelector_Loaded" SelectedColorChanged="FillColor_Selector_SelectedColorChanged"/>
Through the UI, the user can add custom colors, then when the picker is selected, the loaded event binds as follows:
private void RadColorSelector_Loaded( object sender, RoutedEventArgs e )
     RadColorSelector sel = sender as RadColorSelector;
     sel.NoColorText = "Transparent";
     sel.MainPaletteHeaderText = "Standard Colors";
     sel.StandardPaletteHeaderText = "Custom Colors";
     sel.MainPaletteColumnsCount = 10;
     GetStandardColors();            // populate HeaderColors & MainColors
     sel.HeaderPaletteItemsSource = HeaderColors;
     sel.MainPaletteItemsSource = MainColors;
     sel.StandardPaletteItemsSource = CustomColors;
This all works fine, but after displaying the color picker once, If I add more custom colors through my UI, the picker still shows the old list of custom colors.  The new ones do not appear, even if I do an UpdateLayout.  How can I make the picker recognize newly added custom colors when displaying the picker multiple times?



1 Answer, 1 is accepted

Sort by
Kiril Stanoev
Telerik team
answered on 04 Aug 2010, 11:55 AM
Hello Terry,

Instead of using Collection<Color> you need to use ObservableCollection<Color> for your scenario to work. Please have a look at the attached project for further reference.

Kiril Stanoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Asked by
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question