TemplateGroupCollection クラス
アセンブリ: System.Design (system.design.dll 内)


ControlDesigner クラスおよびすべての派生クラスでは、TemplateGroups プロパティは TemplateGroupCollection オブジェクトとして定義されます。TemplateGroupCollection プロパティは通常、Visual Studio 2005 などのデザイン ホストによってのみ使用されます。
コレクションのサイズは、オブジェクトが追加されるごとに動的に大きくなります。このコレクションのインデックスは 0 から始まります。コレクション内に存在するグループの数を確認するには、Count プロパティを使用します。

ControlDesigner クラスから派生する単純なコントロール デザイナを定義する方法を次のコード例に示します。派生コントロール デザイナは、基本クラスに対して定義されているテンプレート グループを取得し、派生コントロール デザイナに固有のテンプレート グループを追加して、TemplateGroups プロパティを実装します。
Imports System Imports System.Web.UI Imports System.Web.UI.Design Imports System.Web.UI.WebControls Imports System.Web.UI.Design.WebControls Imports System.ComponentModel Imports System.ComponentModel.Design Namespace Examples.AspNet ' Define a simple control designer that adds a ' template group to the template group collection. Class DerivedControlDesigner Inherits System.Web.UI.Design.ControlDesigner Private Dim internalControl As DerivedControl = Nothing Private Const templateGroupName As String = "My template group" Private Const templateDefinitionName1 As String = "First" Private Const templateDefinitionName2 As String = "Second" Private Dim internalGroup As TemplateGroup = Nothing ' Override the read-only TemplateGroups property. ' Get the base group collection, and add a group ' with two template definitions for the derived ' control designer. Public Overrides ReadOnly Property TemplateGroups As TemplateGroupCollection Get ' Start with the groups defined by the base designer class. Dim groups As TemplateGroupCollection = MyBase.TemplateGroups If internalGroup Is Nothing ' Define a new group with two template definitions. internalGroup = New TemplateGroup(templateGroupName, _ internalControl.ControlStyle) Dim templateDef1 As TemplateDefinition = new TemplateDefinition(Me, _ templateDefinitionName1, internalControl, _ templateDefinitionName1, internalControl.ControlStyle) Dim templateDef2 As TemplateDefinition = new TemplateDefinition(Me, _ templateDefinitionName2, internalControl, _ templateDefinitionName2, internalControl.ControlStyle) internalGroup.AddTemplateDefinition(templateDef1) internalGroup.AddTemplateDefinition(templateDef2) End If ' Add the new template group to the collection. groups.Add(internalGroup) return groups End Get End Property End Class ' Simple Web control, derived from the Web control class. <DesignerAttribute(GetType(DerivedControlDesigner), GetType(IDesigner))> _ Public Class DerivedControl Inherits WebControl ' Define derived control behavior here. End Class End Namespace
using System; using System.Web.UI; using System.Web.UI.Design; using System.Web.UI.WebControls; using System.Web.UI.Design.WebControls; using System.ComponentModel; using System.ComponentModel.Design; namespace Examples.AspNet { // Define a simple control designer that adds a // template group to the template group collection. class DerivedControlDesigner : System.Web.UI.Design.ControlDesigner { private DerivedControl internalControl = null; private const String templateGroupName = "My template group"; private const String templateDefinitionName1 = "First"; private const String templateDefinitionName2 = "Second"; private TemplateGroup internalGroup = null; // Override the read-only TemplateGroups property. // Get the base group collection, and add a group // with two template definitions for the derived // control designer. public override TemplateGroupCollection TemplateGroups { get { // Start with the groups defined by the base designer class. TemplateGroupCollection groups = base.TemplateGroups; if (internalGroup == null) { // Define a new group with two template definitions. internalGroup = new TemplateGroup(templateGroupName, internalControl.ControlStyle); TemplateDefinition templateDef1 = new TemplateDefinition(this, templateDefinitionName1, internalControl, templateDefinitionName1, internalControl.ControlStyle); TemplateDefinition templateDef2 = new TemplateDefinition(this, templateDefinitionName2, internalControl, templateDefinitionName2, internalControl.ControlStyle); internalGroup.AddTemplateDefinition(templateDef1); internalGroup.AddTemplateDefinition(templateDef2); } // Add the new template group to the collection. groups.Add(internalGroup); return groups; } } } // Define a simple web control, and associate it with the designer. [DesignerAttribute(typeof(DerivedControlDesigner), typeof(IDesigner))] public class DerivedControl : WebControl { // Define derived control behavior here. } }

System.Web.UI.Design.TemplateGroupCollection


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTemplateGroupCollection クラスを検索する場合は、下記のリンクをクリックしてください。

- TemplateGroupCollection クラスのページへのリンク