다음을 통해 공유


MetadataStore 클래스

업데이트: 2007년 11월

사용자 지정 디자인 타임 특성의 컨테이너입니다.

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

구문

Public NotInheritable Class MetadataStore

정적 클래스의 멤버에 액세스하기 위해 정적 클래스의 인스턴스를 선언할 필요가 없습니다.
public static class MetadataStore
public ref class MetadataStore abstract sealed
public final class MetadataStore

설명

MetadataStore 클래스를 사용하여 사용자 지정 디자인 타임 특성을 형식에 연결할 수 있습니다. AttributeTableBuilder를 사용하여 만드는 AttributeTable에 사용자 지정 특성을 지정합니다.

AddAttributeTable 메서드를 사용하여 메타데이터 저장소에 특성 테이블을 추가합니다. 추가된 특성은 TypeDescriptor 메서드를 호출할 때 나타납니다.

예제

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

' 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());
    }
}

상속 계층 구조

System.Object
  Microsoft.Windows.Design.Metadata.MetadataStore

스레드로부터의 안전성

이 형식의 모든 공용 static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

참고 항목

참조

MetadataStore 멤버

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

AttributeTable

AttributeTableBuilder

기타 리소스

메타데이터 저장소