How to: Create a Value Editor

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

The extensibility model for the WPF Designer for Visual Studio enables you to provide value editors for property values in the Properties window at design time. Value editors consist of two types: inline value editors and extended value editors. An inline value editor appears in the Properties window itself, whereas an extended value editor opens a new window for editing. 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 Data Templating Overview.

  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 Providing Design-time Metadata.

  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 Walkthrough: Providing Custom Design-time Metadata.

See Also

Tasks

Walkthrough: Creating a Category Editor

Walkthrough: Providing Custom Design-time Metadata

Reference

PropertyValueEditor

Concepts

Providing Design-time Metadata

Other Resources

WPF Designer Extensibility