TemplateDefinition Class
Provides properties and methods that define a template element in a Web server control at design time.
Assembly: System.Design (in System.Design.dll)
The TemplateDefinition type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | TemplateDefinition(ControlDesigner, String, Object, String) | Initializes a new instance of the TemplateDefinition class, using the provided designer, template name, template, and property name. |
![]() | TemplateDefinition(ControlDesigner, String, Object, String, Boolean) | Initializes a new instance of the TemplateDefinition class, using the provided designer, template name, template, property name, and whether to limit the template contents to Web server controls. |
![]() | TemplateDefinition(ControlDesigner, String, Object, String, Style) | Initializes a new instance of the TemplateDefinition class, using the provided designer, template name, template, property name, and Style object. |
![]() | TemplateDefinition(ControlDesigner, String, Object, String, Style, Boolean) | Initializes a new instance of the TemplateDefinition class, using the provided designer, template name, template, property name, Style object, and whether to limit content to Web server controls. |
| Name | Description | |
|---|---|---|
![]() | AllowEditing | Gets a value that indicates whether the template should enable editing of its contents. |
![]() | Content | Gets or sets the HTML markup representing the content of the template. |
![]() | Designer | Gets the associated designer component. (Inherited from DesignerObject.) |
![]() | Name | Gets the name of the object. (Inherited from DesignerObject.) |
![]() | Properties | Gets the object's properties. (Inherited from DesignerObject.) |
![]() | ServerControlsOnly | Retrieves a value indicating whether the template should limit content to Web server controls, as set in the TemplateDefinition constructor. This property is read-only. |
![]() | Style | Retrieves the style that should be applied to the template as set in the TemplateDefinition constructor. This property is read-only. |
![]() | SupportsDataBinding | Retrieves or sets a value indicating whether the template supports data binding. |
![]() | TemplatedObject | Retrieves the component in which the template resides. This property is read-only. |
![]() | TemplatePropertyName | Retrieves the property name for the template that the design host should display in the property grid. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetService | Gets a service from the design host, as identified by the provided type. (Inherited from DesignerObject.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | IServiceProvider::GetService | For a description of this member, see IServiceProvider::GetService. (Inherited from DesignerObject.) |
The TemplateDefinition class provides a base template definition class that can be inherited from and extended for a control designer to use in providing support for templated controls in a design host such as Visual Studio 2005. A design host uses the properties and methods of the TemplateDefinition class to facilitate creating and editing a template at design time.
The following code example demonstrates how to derive a custom class from the ControlDesigner class. This control designer supports a control with four possible templates.
To try it, add a reference to the System.Design.dll assembly, compile the code, and then, in a design host such as Visual Studio 2005, look at the page in Design view. Select the control, click the action list to select a template to modify, and then use the drag-and-drop feature to move controls into the template.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.




