更新 : 2007 年 11 月
指定されたテーブルを現在の AppDomain の属性ストアに追加します。
名前空間 : Microsoft.Windows.Design.Metadata
アセンブリ : Microsoft.Windows.Design (Microsoft.Windows.Design.dll 内)
構文
'宣言
Public Shared Sub AddAttributeTable ( _
table As AttributeTable _
)
'使用
Dim table As AttributeTable
MetadataStore.AddAttributeTable(table)
public static void AddAttributeTable(
AttributeTable table
)
public:
static void AddAttributeTable(
AttributeTable^ table
)
public static function AddAttributeTable(
table : AttributeTable
)
パラメータ
table
型 : Microsoft.Windows.Design.Metadata.AttributeTable追加するテーブル。
例外
例外 | 条件 |
---|---|
ArgumentNullException | table が nullnull 参照 (Visual Basic では Nothing) です。 |
解説
属性テーブルを追加したら、TypeDescriptor を呼び出すことにより、新しく追加したテーブルで定義されている属性を使用できます。複数のテーブルを 1 つの属性ストアに追加することができます。競合が発生した場合は、最も新しく追加されたテーブル内の属性が優先されます。
例
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());
}
}
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。
参照
参照
Microsoft.Windows.Design.Metadata 名前空間