Introduction
I develop custom server controls in ASP.NET and C#, and one of my challenges is the integration of the controls in VS.NET designer surface. One of the problems is that I haven't found any simple application to see the custom attributes attached to types (example: DesignerAttribute
). I've searched documentation and I've written this simple application to do the job.
Application Description
The application is very simple, you can do the following tasks with it:
- load an assembly: This shows at the bottom panel the custom attributes of the assembly, which can be recalled by double clicking at assembly name, and it shows
public
exported types contained in the assembly in the second panel. - To show custom attributes of a type, click on the type: It loads its properties , methods (not the inherited ones for brevity) and fields in the third panel and type custom attributes in the bottom panel.
- To show custom attributes of a property , method or field, click on it.
The last version shows public
and non public
properties, and optionally by clicking the checkbox
, shows the values of the fields inside attributes.
Details
This application shows a few interesting things, obviously all of these interesting things are explained in other CodeProject articles and various documents, but it is another example:
- Loading assemblies at runtime and discovering its types, methods and properties using reflection
- Obtaining custom attributes and its values at runtime
- Using the
richtextbox
with simplicity which has being a discovery for me
To Do
There are few improvements which I can figure out:
- Make the attribute description to show the exact type where it is declared, now it flattens the type hierarchy causing the same attribute to be shown more that one time and possibly with different values.
- Use a tree control to show the types hierarchy
History
- 02/29/2003 - Initial release
- 02/30/2003 - Added the possibility to show non
public
properties of attributes, and optionally (by clicking the checkbox
) the possibility to show field values (public
and non public
) of attributes which are of different colour - 02/30/2003 (II)- Added the possibility to show attributes for fields in types
Conclusion
I've achieved my objective to find what Designers are attached to control types of System.Web
. I'll follow my investigations, and I've another tool in my toolbox
.
By the way, the documentation and public articles on modifying and personalizing the design time of controls are very poor or I haven't found an article that gives in-depth information. Please let me know if you have found one.
Thanks for this great site!
License
This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below.
A list of licenses authors might use can be found here.