I gave up and joined them, Style-Wize atleast.
-
I finally decided to just along with VS.NET's Designer and use of Style for my custom web/server-side combobox component style attributes instead of ComponentStyle to store my component's main style attributes in. There were several reasons I tried to use ComponentStyle component: 1) Adding attributes with letters of different cases causes multiple enteries in the string. 2) The Designer doesn't show a default style property editor for Styles 3) You can not create a Shadowed Read/Write Property for Style, so you can't address the previous two issues. 4) A minor point, my component exposes four styles, maybe five in the future, so I wanted to make it clear which style does what. So while style is the conventional name for this property, it isn't immediately clear that it only applies to the component and not any of the sub-components, like the text-box, list-box, or the image-button. It would be very nice if there were a way to tell the designer to use my style property, even if it isn't named Style. Also, it would be nice if in the Designer you could use the built-in style property editor for custom web/server-side components. It's not perfect, but it's better than directly editing the HTML inline style string. It would go along way to solving my issues with using Style. Has anyone out there been able to add a style property editor to their components?
-
I finally decided to just along with VS.NET's Designer and use of Style for my custom web/server-side combobox component style attributes instead of ComponentStyle to store my component's main style attributes in. There were several reasons I tried to use ComponentStyle component: 1) Adding attributes with letters of different cases causes multiple enteries in the string. 2) The Designer doesn't show a default style property editor for Styles 3) You can not create a Shadowed Read/Write Property for Style, so you can't address the previous two issues. 4) A minor point, my component exposes four styles, maybe five in the future, so I wanted to make it clear which style does what. So while style is the conventional name for this property, it isn't immediately clear that it only applies to the component and not any of the sub-components, like the text-box, list-box, or the image-button. It would be very nice if there were a way to tell the designer to use my style property, even if it isn't named Style. Also, it would be nice if in the Designer you could use the built-in style property editor for custom web/server-side components. It's not perfect, but it's better than directly editing the HTML inline style string. It would go along way to solving my issues with using Style. Has anyone out there been able to add a style property editor to their components?
The following code does not solve this problem, but it does make the property visable in the VS.NET 2003 Design Property Window. However, because it is ReadOnly it can not be edited. Also, because it is not recognized as one of the supported properties (Int, Unit, String, Boolean, etc.) the property window does not offer an editor.
Private ReadOnly Property \[Style\]() As System.Web.UI.CssStyleCollection Get Dim cbx As cwcComboBox = CType(Me.Component, cwcComboBox) Return cbx.Style End Get End Property ' Style Protected Overrides Sub PreFilterProperties(ByVal properties As IDictionary) MyBase.PreFilterProperties(properties) ' ' Modify Style property to allow it to be seen in the properties window. ' properties("Style") = \_ TypeDescriptor.CreateProperty( \_ Me.GetType(), \_ "Style", \_ Style.GetType(), \_ CategoryAttribute.Design, \_ DesignOnlyAttribute.No) End Sub
Does anyone know what needs to be done to allow the built-in Style editor to be used with this property, or for that matter any other custom style property? Also, I'm using CategoryAttribute.Design to make Style appear in the Design group of the property window, but help seems to indicate that you can put in in any category, including a custom one such at "Component", but it doesn't show how to do this. Anyone know how I can do this? Thank you