Reputation: 147
I created an enum with some of the named colors we can find in Visual Studio. I would like to assign them to an ellipse (WPF tool), but I can't find how to do.
Here is my code :
public enum Color_light
{
None,
GhostWhite,
Yellow,
AliceBlue,
OrangeRed,
Red
}
public Color_light light_color
{
get { return light_color; }
set
{
light_color = value;
lumiere.Fill = [...]
}
}
Lumiere is the name of my ellipse.
Upvotes: 0
Views: 59
Reputation: 147
Color col = (Color)ColorConverter.ConvertFromString(light_color.ToString());
Brush brush = new SolidColorBrush(col);
lumiere.Fill = brush;
Upvotes: 1