When asp.net|web| controls are designed, we often need to use our own defined classes as properties of the control.
Unfortunately, however, the IDE does not know in advance the birth of the new category, so we need
There are typeconverter to convert the objects you define to a string display to the control
Property page, the string in the property page (the color in ASPX is also a string, such as:
#eef008) into the custom class.
The TypeConverter implementation steps can be in the following two ways:
One: Apply the system-defined TypeConverter class to the custom attribute class, such as applying
Expandableobjectconverter and so on.
Second: Apply your own defined TypeConverter class, make a conversion to the custom attribute class.
The first way that I have in the previous article has been examples where we focus on the second way, first of all a suggestion
Yes, if you want to use a custom TypeConverter class to do the conversion, this class is best to inherit TypeConverter, not
Inherit Expandableobjectconverter, and so on, from the TypeConverter inherited class.
Applying Expandableobjectconverter allows attributes to be displayed in a tree structure, while the TypeConverter is written by itself
Is that you can use the edit string to change the property settings if you inherit the TypeConverter in your own definition
Expandableobjectconverter, I've found that sometimes when you edit a child property of a class attribute, the IDE sometimes does not
Timely update Parentproperty (the attributes of the custom class have been added notifyparentproperty=true), so
It's best not to inherit Expandableobjectconverter with the TypeConverter class you write, though
You can modify the property values of a Web control by modifying the child properties of the Class property, or you can edit the string to modify the property directly.
But sometimes there are small problems that make you feel uncomfortable.
Therefore, it is recommended to either directly apply the Expandableobjectconverter, or write the property class to inherit
TypeConverter, do not inherit expandableobjectconverter.