Sdílet prostřednictvím


AttributeTableBuilder.CreateTable – metoda

Vytvoří atribut tabulky aplikace obsahující všechny definice atributu poskytované prostřednictvím AddCustomAttributes volání.

Obor názvů:  Microsoft.Windows.Design.Metadata
Sestavení:  Microsoft.Windows.Design.Extensibility (v Microsoft.Windows.Design.Extensibility.dll)

Syntaxe

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

Vrácená hodnota

Typ: Microsoft.Windows.Design.Metadata.AttributeTable
Tabulka atribut lze použít k definování metadat návrhu.

Poznámky

Tabulka je snímek aktuálního stavu Tvůrce atribut. Všech následných AddCustomAttributes volání nejsou zahrnuty do tabulky. Pokud byly zpětně volané metody deklarovat atributy, tyto metody budou hodnoceny během CreateTable. Namísto toho tabulka bude obsahovat tyto zpětná volání a vyhodnotí jejich potřeby.

Příklady

Následující příklad kódu ukazuje, jak sestavit AttributeTable a přidat do návrhu metadat. Metadata Třídy připojí poskytovatele adorner řízení. Další informace naleznete v tématu Walkthrough: Creating a Design-time Adorner.

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

Zabezpečení rozhraní .NET Framework

Viz také

Odkaz

AttributeTableBuilder Třída

Microsoft.Windows.Design.Metadata – obor názvů

AttributeTable

AttributeCallbackBuilder