0

I'm using the custom ColorPicker control provided by the Extended WPF Toolkit.

I have a configuration file where the application take the color, this color is in string format, like: #FFF0E68C.

Now I'm trying to convert the string in color and valorize the ColorPicker color in this way:

var converter = new BrushConverter();
var brush = (Brush)converter.ConvertFromString("#FFF0E68C");
MyColorPicker.SelectedColor = brush;

but on the last line I get this error:

Implicit conversion from the type 'System.Windows.Media.Brush' in 'System.Windows.Media.Color?'

I doesn't have any Media.Color in brush, how can I fix this? Maybe someone know a better solution for achieve this target?

Thanks in advance.

2 Answers 2

1

As @Mixim suggested, I simply solve the problem in this way:

var color = (Color)ColorConverter.ConvertFromString(settings.SyncCalendarColor);
MyColorPicker.SelectedColor = color;

Thanks :)

Sign up to request clarification or add additional context in comments.

Comments

0

May be you donn't need to use BrushConverter and Brush, you should use ColorConverter and Color

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.