AttributeTableBuilder.CreateTable メソッド

AddCustomAttributes の呼び出しを通じて提供される、すべての属性定義が含まれる属性テーブルを作成します。

名前空間:  Microsoft.Windows.Design.Metadata
アセンブリ:  Microsoft.Windows.Design.Extensibility (Microsoft.Windows.Design.Extensibility.dll 内)

構文

'宣言
Public Function CreateTable As AttributeTable
public AttributeTable CreateTable()
public:
AttributeTable^ CreateTable()
member CreateTable : unit -> AttributeTable 
public function CreateTable() : AttributeTable

戻り値

型: Microsoft.Windows.Design.Metadata.AttributeTable
デザイン時メタデータを定義するために使用できる属性テーブル。

解説

テーブルは、属性ビルダーの現在の状態のスナップショットです。 以降の AddCustomAttributes の呼び出しは、そのテーブルに含まれません。 コールバック メソッドを使用して属性を宣言した場合、それらのメソッドは CreateTable の実行中には評価されません。 代わりに、これらのコールバックはテーブルに格納され、必要に応じて評価されます。

AttributeTable を作成して、デザイン時のメタデータに追加する方法を次のコード例に示します。 Metadata クラスは、装飾プロバイダーをコントロールにアタッチします。 詳細については、「チュートリアル : デザイン時装飾の作成」を参照してください。

' Container for any general design-time metadata to initialize.
' Designers look for a type in the design-time assembly that 
' implements IProvideAttributeTable. If found, designers instantiate
' this class and access its AttributeTable property automatically.
Friend Class Metadata
    Implements IProvideAttributeTable

    ' Accessed by the designer to register any design-time metadata.
    Public ReadOnly Property AttributeTable() As AttributeTable _
        Implements IProvideAttributeTable.AttributeTable
        Get
            Dim builder As New AttributeTableBuilder()

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

            Return builder.CreateTable()
        End Get
    End Property


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

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

            return builder.CreateTable();
        }
    }
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

AttributeTableBuilder クラス

Microsoft.Windows.Design.Metadata 名前空間

AttributeTable

AttributeCallbackBuilder