更新 : 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 メソッドを呼び出すと表示されます。
例
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) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
参照
参照
Microsoft.Windows.Design.Metadata 名前空間