It needs a little work, though. Especially design-wise... ;)
I just put up a short article about adding expandable properties. I realized it's very similar to yours when I was almost finished (and run into that TypeConverter issue which I solved with your article).
I also think I made a mistake in my article. I think I applied the TypeConverter attribute in the wrong location. In your example, you applied it to the entire class, like this:
Code:
<TypeConverter(GetType(HighlightingTypeConverter))> _
Public Class Highlighting
However, in my example, I have added it to the public property of the class that has the convertible object. I think in your example, that would turn out like this:
Code:
<DefaultValue(ââ), Category(âAppearanceâ), _
TypeConverter(GetType(HighlightingTypeConverter)), _
PersistenceMode(PersistenceMode.InnerProperty), _
DesignerSerializationVisibility (DesignerSerializationVisibility.Content)> _
Public Property Highlighting As Highlighting
Obviously, by adding the attribute to the entire class, you get the behavior for free in all other locations with a HighLighting property, so it makes a lot more sense to apply it there.
But doesn't it "dirty up" the class? Are you aware of any side effects of applying this attribute? By applying it to the public property, you apply it right where it's needed: just so the designer knows how to deal with that specific property.
I am inclined to apply it to the entire class rather than to the public property, but I am not sure. Any ideas?
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
Hello It's Me by
Lou Reed & John Cale (Track 15 from the album:
Songs For Drella)
What's This?