To Whom It May Concern,
I am trying to Set the ColorEditBox Value thru a binding like thisHere is the Converter
Any suggestions & Code Samples Would be greatly appreciated
Colin
I am trying to Set the ColorEditBox Value thru a binding like this
<Converters:ColorStringConverter x:Key="ColorConverter"/>
<editors:ColorEditBox
Width="56"
Format="#RXGXBX"
CheckBoxVisibility="Visible"
IsAlphaComponentVisible="False"
IsChecked="{Binding Path=IsSelected, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Value="{Binding Path=ColorString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<!--no matter what i try I can not get the color to change.
I have even injected a Converter that returns a Color object &
I also tried to set the Initial Value.
My Value is a string like this #FFFF00 -->
<!--Value="{Binding Path=ColorString, Converter={StaticResource ColorConverter},Mode=TwoWay}-->
<!--InitialValue="{Binding Path=ColorString, Converter={StaticResource ColorConverter}}"-->
internal class ColorStringConverter:
IValueConverter
{
#region IValueConverter Members
public object Convert
(
object value,
Type targetType,
object parameter,
System.Globalization.CultureInfo culture
)
{
SolidColorBrush m_ColorBrush = new SolidColorBrush(Colors.White);
try
{
BrushConverter m_ColorCon = new BrushConverter();
m_ColorBrush = (SolidColorBrush)m_ColorCon.ConvertFromString(value.ToString());
}
catch (Exception ex)
{
System.Windows.MessageBox.Show("ERROR:" + ex.Message + " STACK<" + ex.StackTrace + ">")
}
return m_ColorBrush.Color;
}
public object ConvertBack
(
object value,
Type targetType,
object parameter,
System.Globalization.CultureInfo culture
)
{
throw new NotImplementedException();
}
#endregion IValueConverter Members
Colin