As you suspect, the primary use of the ToolboxData
attribute is to provide additional markup for default values of the control. From MSDN:
To specify initial default values, a control can make use of this attribute. You can use this attribute to customize the initial HTML content that is placed in the designer when the control is dragged from the toolbox onto the form.
For custom controls, only the tag prefix can be customized and is registered to relate to a namespace in an assembly. The control itself is identified by using the class name as tag name. You cannot change this as you can for a user control.
I agree with you that the design of the ToolboxData
attribute tempts to try to change the tag name as you specify the complete tag including the tag name - though there is a placeholder for the tag prefix. It would be cleaner if there was also a placeholder for the tag name. This would also avoid errors when you change the class name of a custom control and forget to change the string in the ToolboxData
attribute.