Método AttributeTableBuilder.CreateTable

Cria uma tabela de atributo que contém as definições de atributo fornecidas através de AddCustomAttributes chamadas.

Namespace:  Microsoft.Windows.Design.Metadata
Assembly:  Microsoft.Windows.Design.Extensibility (em Microsoft.Windows.Design.Extensibility.dll)

Sintaxe

'Declaração
Public Function CreateTable As AttributeTable
public AttributeTable CreateTable()
public:
AttributeTable^ CreateTable()
member CreateTable : unit -> AttributeTable 
public function CreateTable() : AttributeTable

Valor de retorno

Tipo: Microsoft.Windows.Design.Metadata.AttributeTable
Tabela de atributos que pode ser usada para definir os metadados de tempo de design.

Comentários

A tabela é um instantâneo do estado atual do construtor de atributo. Qualquer subseqüentes AddCustomAttributes chamadas não são incluídas na tabela. Se os métodos de retorno de chamada foram usados para declarar atributos, esses métodos não serão avaliados durante CreateTable. Em vez disso, a tabela conterá os retornos de chamada e irá avaliá-las conforme necessário.

Exemplos

O exemplo de código a seguir mostra como criar um AttributeTable e adicioná-lo para metadados de tempo de design. O Metadata classe anexa um provedor de adorno para um controle. For more information, see Walkthrough: Criando um adorno em tempo de design.

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

Segurança do .NET Framework

Consulte também

Referência

AttributeTableBuilder Classe

Namespace Microsoft.Windows.Design.Metadata

AttributeTable

AttributeCallbackBuilder