I have a property grid object that requires you to choose an enum, for example, you have:
enum XScalingType { ShowAll, Fixed, Sigma }
Now, based on this enum selection, we only care about certain parameters. Namely:
ShowAll - requires none
Fixed - double Minimum, double Maximum
Sigma - double Sigma
This leaves me with the following class
class MyPrefs
XScalingType XScale
double minimum //only matters when XScale = Fixed
double maximum //only matters when XScale = Fixed
double Sigma //only matters when XScale = sigma
I’m not sure how to proceed from here. My thoughts where, I need to make min\max\sigma all members, and just hide them from the grid if they aren’t used.
However, that doesn’t seem like common practice. Is there a more formal way to use these optional parameters based on other enum selections?
I’m wondering if I’m approaching this from the wrong direction completely.
A better approach is to create state-aware property accessors like the following:
then if XScale is anything other than Sigma, the property Sigma will show empty.