Edit this page

Color History

The RadColorEditor control enables you to keep track of the previously selected colors through a set of proeprties.

  • PreviousColor - this property is of type Color and provides access to the last selected color.

  • ColorHistory - this property exposes a collection of all previously selected colors.

    XAML

    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
        <StackPanel.Resources>
            <telerik:ColorToBrushConverter x:Key="ColorConverter" />
        </StackPanel.Resources>
        <telerik:RadColorEditor x:Name="colorEditor1" Width="400" Height="220" HistoryCapacity="5" />
        <ItemsControl ItemsSource="{Binding ColorHistory, ElementName=colorEditor1}" Height="20" Margin="8 0">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Border Width="20" Height="20" Margin="5 0"
                            Background="{Binding Converter={StaticResource ColorConverter} }" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <telerik:RadWrapPanel />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
    </StackPanel>
    
  • HistoryCapacity - this property is of type int. It gets/set the number of previously used colors to be stored in the ColorHistory collection.

See Also