G
Guest
(using .NET Framework 1.1)
Hello,
I'm finishing work on a component that is available for users in their
visual designer. It has various properties that can be sent by users. Using
"DynamicProperties" users can set my component's properties to be saved in
their application's configuration file (to be later changed on per
installation basics).
Unfortunatelly it doesn't seem to work with properties that are
enumerations. No matter if I mark enum property with
[RecommendedAsConfigurable(true)] or not, it is still not available in
DynamicProperties (even in Advanced settings).
I've taken a look at what code is generated for string properties loaded
from configuration settings and it looks like it would be enough to replace
"(string)" with "(myenumtype)". Seems trivial but how to make code generator
do that?
I've tried to find a solution to this problem and the only thing I've found
that actually worked was switching property from enumaration to string and
implementing a special class that displays a set of options in visual
designer.
Unfortunatelly this workaround can't be called a solution as it has a
serious limitation - if user needs to change property's value at runtime, sie
needs to enter new value as a string - this doesn't work anymore:
mycomponent.myproperty = type.value;
Users need to write code like this:
mycomponent.myproperty = "value";
which looks bad, is easier to make errors and doesn't allow intellisense to
help the user.
I haven't found any other solution.
Fortunatelly the problem looks like something really common, so the solution
shouldn't be that far away.
Do you have any ideas how can I solve this problem? Could you share them?
Hello,
I'm finishing work on a component that is available for users in their
visual designer. It has various properties that can be sent by users. Using
"DynamicProperties" users can set my component's properties to be saved in
their application's configuration file (to be later changed on per
installation basics).
Unfortunatelly it doesn't seem to work with properties that are
enumerations. No matter if I mark enum property with
[RecommendedAsConfigurable(true)] or not, it is still not available in
DynamicProperties (even in Advanced settings).
I've taken a look at what code is generated for string properties loaded
from configuration settings and it looks like it would be enough to replace
"(string)" with "(myenumtype)". Seems trivial but how to make code generator
do that?
I've tried to find a solution to this problem and the only thing I've found
that actually worked was switching property from enumaration to string and
implementing a special class that displays a set of options in visual
designer.
Unfortunatelly this workaround can't be called a solution as it has a
serious limitation - if user needs to change property's value at runtime, sie
needs to enter new value as a string - this doesn't work anymore:
mycomponent.myproperty = type.value;
Users need to write code like this:
mycomponent.myproperty = "value";
which looks bad, is easier to make errors and doesn't allow intellisense to
help the user.
I haven't found any other solution.
Fortunatelly the problem looks like something really common, so the solution
shouldn't be that far away.
Do you have any ideas how can I solve this problem? Could you share them?