TemplateGroupCollection クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TemplateGroupCollection クラスの意味・解説 

TemplateGroupCollection クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

コントロール デザイナ内の TemplateGroup オブジェクトコレクション表します。このクラス継承できません。

名前空間: System.Web.UI.Design
アセンブリ: System.Design (system.design.dll 内)
構文構文

Public NotInheritable Class
 TemplateGroupCollection
    Implements IList, ICollection, IEnumerable
Dim instance As TemplateGroupCollection
public sealed class TemplateGroupCollection
 : IList, ICollection, IEnumerable
public ref class TemplateGroupCollection sealed
 : IList, ICollection, IEnumerable
public final class TemplateGroupCollection
 implements IList, ICollection, 
    IEnumerable
public final class TemplateGroupCollection
 implements IList, ICollection, 
    IEnumerable
解説解説

ControlDesigner クラスおよびすべての派生クラスでは、TemplateGroups プロパティTemplateGroupCollection オブジェクトとして定義されます。TemplateGroupCollection プロパティ通常Visual Studio 2005 などのデザイン ホストによってのみ使用されます。

コレクションサイズは、オブジェクト追加されるごとに動的に大きくなります。このコレクションインデックスは 0 から始まりますコレクション内に存在するグループの数を確認するには、Count プロパティ使用します

さらに、TemplateGroupCollectionメソッドおよびプロパティ使用して次の機能提供します

使用例使用例

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.Object
  System.Web.UI.Design.TemplateGroupCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からTemplateGroupCollection クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からTemplateGroupCollection クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からTemplateGroupCollection クラス を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「TemplateGroupCollection クラス」の関連用語

TemplateGroupCollection クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



TemplateGroupCollection クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS