다음을 통해 공유


AttributeTableBuilder.CreateTable 메서드

업데이트: 2007년 11월

AddCustomAttributes 호출을 통해 제공된 모든 특성 정의가 들어 있는 특성 테이블을 만듭니다.

네임스페이스:  Microsoft.Windows.Design.Metadata
어셈블리:  Microsoft.Windows.Design(Microsoft.Windows.Design.dll)

구문

Public Function CreateTable As AttributeTable

Dim instance As AttributeTableBuilder
Dim returnValue As AttributeTable

returnValue = instance.CreateTable()
public AttributeTable CreateTable()
public:
AttributeTable^ CreateTable()
public function CreateTable() : AttributeTable

반환 값

형식: Microsoft.Windows.Design.Metadata.AttributeTable

메타데이터 저장소에 전달할 수 있는 특성 테이블입니다.

설명

테이블은 특성 작성기의 현재 상태에 대한 스냅숏입니다. 이후에 AddCustomAttributes를 호출한 결과는 테이블에 포함되지 않습니다. 콜백 메서드를 사용하여 특성을 선언한 경우 CreateTable이 실행될 때까지 이러한 메서드가 실행되지 않습니다. 테이블에 이러한 콜백이 대신 포함되어 필요에 따라 실행됩니다.

예제

다음 코드 예제에서는 AttributeTable을 만들어 메타데이터 저장소에 추가하는 방법을 보여 줍니다. Metadata 클래스는 컨트롤에 표시기(Adorner) 공급자를 연결합니다. 자세한 내용은 연습: 디자인 타임 표시기 만들기를 참조하십시오.

' Container for any general design-time metadata to initialize.
' Designers look for a type in the design-time assembly that 
' implements IRegisterMetadata. If found, designers instantiate 
' this class and call its Register() method automatically.
Friend Class Metadata
    Implements IRegisterMetadata

    ' Called by the designer to register any design-time metadata.
    Public Sub Register() Implements IRegisterMetadata.Register
        Dim builder As New AttributeTableBuilder()

        ' Add the adorner provider to the design-time metadata.
        builder.AddCustomAttributes(GetType(ButtonWithDesignTime), _
                                    New FeatureAttribute(GetType(OpacitySliderAdornerProvider)))

        MetadataStore.AddAttributeTable(builder.CreateTable())
    End Sub

End Class
// Container for any general design-time metadata to initialize.
// Designers look for a type in the design-time assembly that 
// implements IRegisterMetadata. If found, designers instantiate 
// this class and call its Register() method automatically.
internal class Metadata : IRegisterMetadata
{
    // Called by the designer to register any design-time metadata.
    public void Register()
    {
        AttributeTableBuilder builder = new AttributeTableBuilder();

        // Add the adorner provider to the design-time metadata.
        builder.AddCustomAttributes(
            typeof(ButtonWithDesignTime), 
            new FeatureAttribute(typeof(OpacitySliderAdornerProvider)));

        MetadataStore.AddAttributeTable(builder.CreateTable());
    }
}

권한

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

AttributeTableBuilder 클래스

AttributeTableBuilder 멤버

Microsoft.Windows.Design.Metadata 네임스페이스

AttributeTable

AttributeCallbackBuilder

기타 리소스

메타데이터 저장소