I am using a RadColorPaletteView with custom colours with 4 RadColorPaletteViewItem's in it each for a color:
And the code behind:
I am clearing the selected index and setting the focus to the color palette view control. Now if I click somewhere inside the color palette view control without selecting any color(RadColorPaletteViewItem) and press any keyboard key then a NullReferenceException is raised.
If I select a color and press a key then a CastException is thrown.
<
telerik:RadColorPaletteView
Grid.Column
=
"0"
x:Name
=
"customPaletteView"
Grid.Row
=
"0"
AllowDrop
=
"False"
>
<
telerik:RadColorPaletteViewItem
Color
=
"Green"
IsEnabled
=
"True"
/>
<
telerik:RadColorPaletteViewItem
Color
=
"Black"
Content
=
"Black"
IsEnabled
=
"False"
/>
<
telerik:RadColorPaletteViewItem
Color
=
"Red"
Content
=
"Red"
IsEnabled
=
"True"
/>
<
telerik:RadColorPaletteViewItem
Color
=
"Yellow"
Content
=
"Yellow"
IsEnabled
=
"True"
/>
</
telerik:RadColorPaletteView
>
private
void
UserControl_Loaded(
object
sender, RoutedEventArgs e)
{
customPaletteView.SelectedIndex = -1;
customPaletteView.Focus();
}
I am clearing the selected index and setting the focus to the color palette view control. Now if I click somewhere inside the color palette view control without selecting any color(RadColorPaletteViewItem) and press any keyboard key then a NullReferenceException is raised.
If I select a color and press a key then a CastException is thrown.