Where is my component's Style?!?!?
-
I've built a custom web/server-side component ComboBox. However, when I tried to explicitly handle property assignments to the Style I get a message saying that that property may only be set at runtime. In my component I actually have three webcontrols: a image-button, a listbox, and a textbox, which in my code, I use as storage for the various properties that my component supports, including the Style properties for each of these controls using distinctive properties for each one: ImageStyle, ListBoxStyle, and TextBoxStyle. And this works for them. Then, as I said at the top of this message, I wanted to create an explicit property for the base class's Style property, and got the error, so I created a new one called ComponentStyle, and changed the Style in my component's tag from Style to ComponentStyle, but nothing shows in the ComponentStyle property in the Designer's Property Window. Strangely, the inline style values are getting rendered in the web-page, so they are being loaded, just not showing in the designer. Here is the code I'm using for my Style and ComponentStyle properties:
' --------------- Property Style -------------------------------- ' Setting Browsable to False to hide this property from the Designer Property window. ' This property uses Shadow to allow me declare the Browsable directive. <Browsable(False), Category("Component"), DefaultValue(""), _ Description("Component level inline CSS string")> _ Public Shadows ReadOnly Property [Style]() As System.Web.UI.CssStyleCollection Get Return MyBase.Style End Get End Property ' Style ' ----------- Property ComponentStyle -------------------------- ' This is the public version of the above property. ' ' The Getter uses the CssStyleCollectionAsString ' function to build a string containing the ' MyBase Style settings. ' ' The Setter uses the ' ApplyCssStyleStringToCssStyleCollection function ' to set the MyBase Style setting from a string. ' ' I know that these helper functions work, I use ' them on through out my program on the other ' components, including CssStyleCollectionAsString ' in the designer to render the component's styles ' for the editor. ' <Browsable(True), Category("Component"), DefaultValue(""), _ Description("Component level inline CSS string")> _ Public Property [ComponentStyle]() As String Get Return CssStyleCollectionAsString(MyBase.Style) End Get Set(ByVal Value As String) ApplyCssStyleStringToCssStyleCol