So I have a main form with 3 controls whose Enable
property I want to control using an enum.
All these controls have a reference to the Data
that contains the Enum
value Level.
enum Level
{
Red,
Yellow,
Green
}
So if it's Red
, I want the RedControl
to become enabled, if it's yellow
, then YellowControl
becomes enabled, etc.
How do I best do this with minimal code and elegance?
I tried having 3 properties like IsRed
, IsYellow
, etc on the Data
to hook them up. But then I didn't know a way to detect the change of Level
from those properties.