Main Page

  Previous Section Next Section

Chapter 37. The System.Web.UI.Design Namespace

The System.Web.UI.Design namespace contains types used for providing design-time support for the Web Forms user interface. These types fall into four basic categories: type converters, UI type editors, designers, and other helper classes (such as classes that provide ASP.NET data binding support). Type converters allow control properties to be converted to and from base data types, which allows them to be displayed and edited in the Properties Window. Type converters also extend runtime support, but they are only used implicitly and never instantiated directly. Type converter classes derive from System.ComponentModel.TypeConverter and end with the word "Converter" by convention. Unlike type converters, UI type editors are used exclusively in the design environment. They provide the custom user interface that is used to select special property values from the Properties window (like a control's color). UI type editors derive from System.Drawing.Design.UITypeEditor and end with the word "Editor."

Designers help provide the design-time representation of a control. They derive from System.ComponentModel.Design.ComponentDesigner and end with the word "Designer." The System.Web.UI.Design namespace contains the base designers used for ASP.NET controls. ASP.NET controls use different designers than Windows Form controls because they are rendered by using HTML rather than Windows-specific GDI+ functions. For custom designers that extend specific controls, refer to the System.Web.UI.Design.WebControls namespace.

Generally, the types in the System.Web.UI.Design namespace are never used directly in the runtime logic of an application. However, they are useful for ASP.NET control designers. For example, if you are creating a custom Web Forms control from scratch, you may want to derive from ControlDesigner to create a custom designer. However, you may find it more convenient to extend an existing web control—in which case, you would continue using the default designers, type converters, and UI type editors, or derive custom versions from the corresponding control-specific class in the System.Web.UI.Design.WebControls namespace, if it exists.

Figure 37-1 shows the fundamental types in this namespace, and Figure 37-2 shows the remaining types.

Figure 37-1. Fundamental types from the System.Web.UI.Design namespace
Figure 37-2. More types from the System.Web.UI.Design namespace
      Previous Section Next Section