How to: Create a Value Editor
The extensibility model for the Windows Presentation Foundation (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
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.
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.
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.
If you have not already done this, create a class that implements the IRegisterMetadata interface and put it in the .Design namespace for your custom control. For more information about how to implement IRegisterMetadata, see How to: Use the Metadata Store.
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 How to: Use the Metadata Store.
See Also
Tasks
Walkthrough: Creating a Category Editor