Johniek Comp
Johniek Comp

Reputation: 443

Color in string the row (datagrid wpf)

i set color

e.Row.Background = new SolidColorBrush(Colors.Tomato);

but how i can set color is string? color code? D7F9C7 for example...

Upvotes: 0

Views: 235

Answers (2)

LPL
LPL

Reputation: 17083

You can use static ColorConverter.ConvertFromString Method:

Color color = (Color)ColorConverter.ConvertFromString("#D7F9C7");

Upvotes: 1

mlemay
mlemay

Reputation: 1637

You can set:

Brush MyBrush = (Brush)new BrushConverter().ConvertFrom("#4CE4FF00");

Upvotes: 2

Related Questions