New to Telerik UI for WPF? Download free 30-day trial

Declaration

This article demonstrates how you can declare a RadColorPaletteView and populate it with colors.

XAML Declaration

<telerik:RadColorPaletteView /> 

Dynamic creation

RadColorPaletteView colorPaletteView = new RadColorPaletteView(); 
Dim colorPaletteView As New RadColorPaletteView() 

Selection

The SelectedItem property holds the selected color:

colorPaletteView.SelectedItem = Colors.Red; 

Populating

You can use the Palette property of RadColorPaletteView to populate the paletteview with one of the built-in palettes.

<telerik:RadColorPaletteView Palette="ColorPreset.Office" /> 

RadColorPaletteView colorPaletteView = new RadColorPaletteView(); 
colorPaletteView.Palette = ColorPreset.Office; 
Dim colorPaletteView As New RadColorPaletteView() 
colorPaletteView.Palette = ColorPreset.Office 

RadColorPaletteView also allows binding to various data source types through the ItemSource property.

<telerik:RadColorPaletteView ItemsSource="{Binding Source={StaticResource MyColorList}}" /> 

RadColorPaletteView colorPaletteView = new RadColorPaletteView(); 
Collection<Color> colors = new Collection<Color>(); 
colors.Add(Colors.Red); 
colors.Add(Colors.Green); 
colors.Add(Colors.Blue); 
colorPaletteView.ItemsSource = colors; 
Dim colorPaletteView As New RadColorPaletteView() 
Dim colors1 As New Collection(Of Color)() 
colors1.Add(Colors.Red) 
colors1.Add(Colors.Green) 
colors1.Add(Colors.Blue) 
colorPaletteView.ItemsSource = colors1 
In this article