Dynamically enumerated values for a property in .Net
Do you know how the ImageList property of a TreeView control lists all the image sheets on a form? I need something similar but with a list of strings. It is similar to an enum, but defined at runtime, with an object that exposes the property in the PropertyGrid.
So, with a list of strings like {"foo", "bar", "grill"}, the property should list them, but if that list of strings is changed (say add a "bbq" element), the property should list {"foo" , "bar", "grill", "bbq"}.
+1
a source to share
2 answers
If this is just a list of the strings you want, take a look at your own TypeConverter
. You need to override the method GetStandardValues
.
+2
a source to share