Como: Criar um editor de valor

O modelo de extensibilidade para o WPF Designer for Visual Studio permite que você forneça os editores de valor para os valores de propriedade najanela de Propriedadesem tempo de design.  Editores deValor consistem em dois tipos: editores de valorembutido e editores de valor estendido. Um valor de embutido editor aparece najanela de Propriedadespropriamente dito, enquanto um valor estendido de editor abre uma nova janela para edição.  The general procedure for creating both kinds of value editors is the same.

To create a value editor

  1. Create a DataTemplate class that binds to the property that you want to provide editing for. For more information about how to create a data template, see Visão geral sobre Templating de dados.

  2. Create a new class to encapsulate the value editor. For inline value editors this class should inherit from PropertyValueEditor. Extended value property editors should inherit from ExtendedPropertyValueEditor.

  3. In the constructor of your value editor class, set the template for your value editor. For inline value editors, you set the InlineEditorTemplate property to a reference to the template for this property. For extended value editors, you set the ExtendedEditorTemplate property. For extended value editors, you can also provide a template for an associated inline value editor by setting the InlineEditorTemplate property.

  4. If you have not already done this, create a class that implements the IProvideAttributeTable interface and put it in the .Design namespace for your custom control. For more information, see Fornecimento de metadados de tempo de design.

  5. In the metadata class you created in step 4, register the value editor class to create the association between the property value and the new value editor. For more information, see Passo a passo: Fornecendo metadados de tempo de design personalizados.

Consulte também

Tarefas

Passo a passo: Criando um editor de categoria

Referência

PropertyValueEditor

Outros recursos

Fornecimento de metadados de tempo de design

Extensibilidade do WPF Designer

Passo a passo: Fornecendo metadados de tempo de design personalizados