❔ How to shorten switch statement
I feel like a noob again. I can't think of how to remove the switch statement. I think I need either the ref keyword or reflections but not sure which and not sure what to do
8 Replies
Looks like you can't return
ref
from a switch, annoyingly
Do you need however-many separate properties? Do you actually use them as properties?yes they are required properties since they're bound to UI controls for WPF
You can bind to e.g. dictionary elements in WPF, if that makes life easier
<TextBlock Text="{Binding Koalas["Kiki"]}"/>
so I could bind to a dictionary of type string bool and get the bool by string?
It's one option
that might make my life significantly easier actually. I'm not the one working on the front end but I'll put the suggestion forwards
That or something like:
Then
"{Binding Koalas.Mim.IsAvailable}"
Then you can do:
(Add INPC as appropriate)Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.