I am trying to do a simple binding on the SelectedColor property of a ColorPicker. I created a simple app to demo my issue.
The XAML:
Thanks
Ernie
The XAML:
<Window x:Class="XceedColorPickerTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:XceedColorPickerTest"
xmlns:xctk="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
Title="MainWindow" Height="350" Width="525">
<Window.DataContext>
<local:MainWindowViewModel />
</Window.DataContext>
<StackPanel>
<xctk:ColorPicker SelectedColor="LightBlue"
ShowDropDownButton="True"
DisplayColorAndName="True" />
<TextBlock Text="{Binding TestBrush}"/>
<xctk:ColorPicker SelectedColor="{Binding TestBrush}"
ShowDropDownButton="True"
DisplayColorAndName="True" />
<TextBlock Text="{Binding TestBrush2}"/>
<xctk:ColorPicker SelectedColor="{Binding TestBrush2}"
ShowDropDownButton="True"
DisplayColorAndName="True" />
</StackPanel>
</Window>
The VM:using System;
namespace XceedColorPickerTest
{
public class MainWindowViewModel
{
public MainWindowViewModel()
{
TestBrush = System.Windows.Media.Brushes.Red;
TestBrush2 = System.Windows.Media.Brushes.Green;
}
public System.Windows.Media.Brush TestBrush { get; set; }
public System.Windows.Media.SolidColorBrush TestBrush2 { get; set; }
}
}
First ColorPicker works as expected. But neither binding in the following two to either TestBrush and TestBrush2 work. They DO work with the TextBlocks which cast the brushes to "#FFFF0000" and "#FF008000", respectively (its not a notification thing as far as I can tell).Thanks
Ernie