We are using WPF telerik control RadColorPicker. In the beginning, we choose to set null color for the entity. The problem is, this null color is being treated as black color by the RadColorPicker and so we can't apply a black color immidiately. Refer to the working code below
XAML:
<telerik:RadColorPicker x:Name="radColorPicker" IsRecentColorsActive="True" SelectedColor="{Binding Path=MyColor}" SelectedColorChanged="radColorPicker_SelectedColorChanged">
<telerik:RadColorPicker.ContentTemplate>
<DataTemplate>
<Rectangle MinWidth="40" MinHeight="20">
<Rectangle.Fill>
<SolidColorBrush Color="{Binding ElementName=radColorPicker, Path=SelectedColor, Mode=TwoWay}"/>
</Rectangle.Fill>
</Rectangle>
</DataTemplate>
</telerik:RadColorPicker.ContentTemplate>
</telerik:RadColorPicker>
Code Behind/View Model:
public Window9()
{
InitializeComponent();
this.DataContext = this;
MyColor = null; // I can't apply a black color in this case because null is being treated as black color
//MyColor = "Red"; // I can apply a black color, when the already applied color is red.
}
private void radColorPicker_SelectedColorChanged(object sender, EventArgs e)
{
MessageBox.Show("Color changed!");
}
public string MyColor { get; set; }
However, if I would choose some other color than black, say Red, then after that I am able to apply a black color or if we by default set a red color first as shown in the code, then also we would be able to set a black color.
How to make RadColorPicker treat null color as null only and not black, so that we can apply black color immidiately.