Link to home
Start Free TrialLog in
Avatar of MSFanboy
MSFanboyFlag for Germany

asked on

Save a properties name in a string, retrieve it again and execute it ?

Hello,

I have several properties which return a Visibility status like Visible/Collapsed to drive my gui`s usercontrols to be shown or not.

now I have 10 Properties like:

public Visibility ChangeModule1VisibilityStatus{get;set;}
public Visibility ChangeModule2VisibilityStatus{get; set;}

then I have a class variable called

private static string _currentPropertyVisible;

Everytime I set a "ChangeModuleXXVisibilityStatus" property to Visible I want to save this property in the _currentPropertyVisible variable. So when I next time change a property again I set the last current Property to Collapsed saved/cached in the _currentPropertyVisible property.

How can I achieve that in a generic way -if possible- ?
Avatar of StorebrorDE
StorebrorDE

How about using an array of your "Visibility" properties (or maybe, if neccessary, an ArrayList to easier extend/shrink it) and store the index of current visible Property?
That way you can access the property itself by it's index from the array later on.
ASKER CERTIFIED SOLUTION
Avatar of MSFanboy
MSFanboy
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial