Reputation: 11
I would like to build an app that will be used by different operators at different events. There are about 5 different events this app will be used. Not all the controls (buttons mainly but also textboxes, checkboxes etc) are needed for every use. So as not to confuse the operator at event "C" that only uses only a subset of the controls that are used at event "A", I would like a way to make any controls that aren't used in all events to be visible based on what event is set in the main applications config.
I'm not sure whether having the Visible property bound to a converter that somehow? gets the current setting in the config or whether I should have some code behind that works it out.
Ideally, I think if I could make a property and some code behind and inherit any controls that need this functionality from it, then it could be pretty much "automatic".
Upvotes: 1
Views: 178
Reputation: 1307
I would think you would have a variable that would hold the result of a choice of operator (A, B, C, etc.) that could be used in a test for what controls you want visible on the form.
Ex:
User chooses "A"
Store "A" or a related value (heck, an integer "1" would work) into a variable "choice".
In your body of code, do an
if(choice == 1){
window.Bcontrol.visibility = "False";
}
where Bcontrol is a control that is for choice B... just replace B with your other control names... and so on and so forth for each different config option. It's probably not the most elegant way, but without seeing the code (or knowing if you're in VB, C#, C++, or F#), I can't get too much more specific.
Upvotes: 1