tags:

views:

42

answers:

1
'#10eeee'

Here's what I'm trying to do:

groupRectangle.Fill = Color.FromHex?

Thank you for your time!

+4  A: 

You're looking for ColorConverter.ConvertFromString.

Color color = (Color)ColorConverter.ConvertFromString("#10eeee");
SolidColorBrush myBrush = new SolidColorBrush(color);

You will need using System.Windows.Media; at the top of your program too.

The following string Color formats should be supported.

Edit: You can also use BrushConverter.

Brian R. Bondy
I get a cannot convert color to brush error. Any ideas?
Sergio Tapia
@Sergio Tapia: You need to create a brush, see my edit.
Brian R. Bondy
Sounds like you want a brush not a colour. Try `new BrushConverter().ConvertFromString("#FFFFFF")`
Graphain