TemplateGroupCollection 클래스

정의

컨트롤 디자이너 내에 있는 TemplateGroup 개체의 컬렉션을 나타냅니다. 이 클래스는 상속될 수 없습니다.

public ref class TemplateGroupCollection sealed : System::Collections::IList
public sealed class TemplateGroupCollection : System.Collections.IList
type TemplateGroupCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public NotInheritable Class TemplateGroupCollection
Implements IList
상속
TemplateGroupCollection
구현

예제

다음 코드 예제에서는 클래스에서 ControlDesigner 파생 된 간단한 컨트롤 디자이너를 정의 하는 방법을 보여 줍니다. 파생된 컨트롤 디자이너는 기본 클래스에 대해 정의된 템플릿 그룹을 가져오고 파생된 컨트롤 디자이너와 관련된 템플릿 그룹을 추가하여 속성을 구현 TemplateGroups 합니다.

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.
    }
}
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

설명

클래스 및 파생 클래스는 ControlDesigner 속성을 개체로 TemplateGroupCollection 정의합니다TemplateGroups. 이 TemplateGroupCollection 속성은 일반적으로 Visual Studio 2005와 같은 디자인 호스트에서만 사용됩니다.

개체가 추가 될 때 컬렉션의 크기가 동적으로 증가 합니다. 이 컬렉션의 인덱스는 0부터 시작 합니다. 사용 된 Count 컬렉션에 있는 그룹의 수를 결정 하는 속성입니다.

또한 사용 하 여를 TemplateGroupCollection 메서드 및 속성을 다음 기능을 제공 합니다.

  • Add 컬렉션에 단일 그룹을 추가하는 메서드입니다.

  • Insert 컬렉션 내의 특정 인덱스에서 그룹을 추가하는 메서드입니다.

  • Remove 그룹을 제거할 메서드입니다.

  • RemoveAt 특정 인덱스에서 그룹을 제거하는 메서드입니다.

  • Contains 특정 그룹이 컬렉션에 이미 있는지 여부를 확인하는 메서드입니다.

  • IndexOf 컬렉션 내에서 그룹의 인덱스 검색을 위한 메서드입니다.

  • Item[] 배열 표기법을 사용하여 특정 인덱스에서 그룹을 얻거나 설정할 인덱서입니다.

  • AddRange 컬렉션에 여러 그룹을 추가하는 메서드입니다.

    여러 그룹을 그룹의 배열로 추가하거나 다른 컨트롤 디자이너의 속성을 통해 TemplateGroups 검색하는 개체로 TemplateGroupCollection 추가할 수 있습니다.

  • Clear 컬렉션에서 모든 그룹을 제거하는 메서드입니다.

생성자

TemplateGroupCollection()

TemplateGroupCollection 클래스의 새 인스턴스를 초기화합니다.

속성

Count

컬렉션에 있는 TemplateGroup 개체의 수를 가져옵니다.

Item[Int32]

컬렉션의 지정된 인덱스에서 TemplateGroup 개체를 가져오거나 설정합니다.

메서드

Add(TemplateGroup)

컬렉션의 끝에 지정된 TemplateGroup 개체를 추가합니다.

AddRange(TemplateGroupCollection)

기존 TemplateGroupCollection 개체의 템플릿 그룹을 현재 TemplateGroupCollection 개체에 추가합니다.

Clear()

컬렉션에서 그룹을 모두 제거합니다.

Contains(TemplateGroup)

지정된 그룹이 컬렉션에 포함되어 있는지 여부를 확인합니다.

CopyTo(TemplateGroup[], Int32)

대상 배열의 지정된 인덱스에서 시작하여 컬렉션의 그룹을 호환 가능한 1차원 배열에 복사합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IndexOf(TemplateGroup)

컬렉션에 있는 지정된 TemplateGroup 개체의 인덱스를 반환합니다.

Insert(Int32, TemplateGroup)

컬렉션의 지정된 인덱스에 TemplateGroup 개체를 삽입합니다.

MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
Remove(TemplateGroup)

컬렉션에서 지정된 TemplateGroup 개체를 제거합니다.

RemoveAt(Int32)

컬렉션의 지정된 인덱스에서 TemplateGroup 개체를 제거합니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

ICollection.CopyTo(Array, Int32)

이 멤버에 대한 설명은 CopyTo(Array, Int32)를 참조하세요.

ICollection.Count

이 멤버에 대한 설명은 Count를 참조하세요.

ICollection.IsSynchronized

이 멤버에 대한 설명은 IsSynchronized를 참조하세요.

ICollection.SyncRoot

이 멤버에 대한 설명은 SyncRoot를 참조하세요.

IEnumerable.GetEnumerator()

이 멤버에 대한 설명은 GetEnumerator()를 참조하세요.

IList.Add(Object)

이 멤버에 대한 설명은 Add(Object)를 참조하세요.

IList.Clear()

이 멤버에 대한 설명은 Clear()를 참조하세요.

IList.Contains(Object)

이 멤버에 대한 설명은 Contains(Object)를 참조하세요.

IList.IndexOf(Object)

이 멤버에 대한 설명은 IndexOf(Object)를 참조하세요.

IList.Insert(Int32, Object)

이 멤버에 대한 설명은 Insert(Int32, Object)를 참조하세요.

IList.IsFixedSize

이 멤버에 대한 설명은 IsFixedSize를 참조하세요.

IList.IsReadOnly

이 멤버에 대한 설명은 IsReadOnly를 참조하세요.

IList.Item[Int32]

이 멤버에 대한 설명을 보려면 IList 클래스를 참조하십시오.

IList.Remove(Object)

이 멤버에 대한 설명은 Remove(Object)를 참조하세요.

IList.RemoveAt(Int32)

이 멤버에 대한 설명은 RemoveAt(Int32)를 참조하세요.

확장 메서드

Cast<TResult>(IEnumerable)

IEnumerable의 요소를 지정된 형식으로 캐스팅합니다.

OfType<TResult>(IEnumerable)

지정된 형식에 따라 IEnumerable의 요소를 필터링합니다.

AsParallel(IEnumerable)

쿼리를 병렬화할 수 있도록 합니다.

AsQueryable(IEnumerable)

IEnumerableIQueryable로 변환합니다.

적용 대상

추가 정보