How to refresh StandardPaletteItemsSource

2 posts, 0 answers
  1. Terry
    Terry avatar
    157 posts
    Member since:
    Jul 2009

    Posted 02 Aug 2010 Link to this post


    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?



  2. Kiril Stanoev
    Kiril Stanoev avatar
    1508 posts

    Posted 04 Aug 2010 Link to this post

    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
  3. DevCraft banner
Back to Top