This project is read-only.

Property Designer and Editor Extensibility

May 23, 2008 at 11:28 PM
The old WinForms Property Grid displays default editors and designers using built-in code. For example it checks what is the type of the property and if there are no custom editors it decides what kind of designer/editor to display. The editor extensibility based on custom Controls and Attributes. This provides the user with an option to extend properties editors and designers with custom ones based on custom Forms and Custom Controls.

For example:

// Custom control which visually creates an image
public class ImageEditor : Control
CustomImage Image { get { return _image; } }

// A custom UITypeEditor which provides Proeprty Gird editor and designer extensibility such as Drop Down style editor
public class ImageUITypeEditor : UITypeEditor
    public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
        // Create the visual custom control editor
        ImageEditor editor = new ImageEditor();
        // Ask the service to display it inside a Drop Down combo box
        return editor.Image;

// Attach the custom editor to class
of type CustomImage or property of type CustomImage using the EditorAttribute attribute
[Editor(typeof(ImageUITypeEditor), typeof(UITypeEditor))]
public class CustomImage

This kind of extensibility mechanism is quite simple to use and really do the job, but it has several disadvantages:
  1. There is a strong coupling between the custom object and the property grid (using the EditorAttribute attribute for example)
  2. 3rd party types can't be displayed correctly. If you don't have the source code, you can't select a custom editor or designer
  3. Designers and Editors are hard coded and can't be restyled by designers
  4. Editor and Designers can only be displayed inside a ComboBox or as Dialog. What about other controls such as Expander or a simple Panel?
For these disadvantages I thinking about writing a different extensibility mechanism which will provide more than one option to extend the property grid with editors and designers.

  • Declarative extensibility mechanism using legacy attributes (for backward compatibility) and new attributes
  • Dynamic extensibility mechanism XML file to decouple types from the Property Grid. This XML will describe what editor/designer to use
  • Data Templates based extensibility mechanism. Leveraging WPF Data Templates, one can use a WPF resource file to select designers/editors (see POC code)
Aug 7, 2009 at 12:39 PM

I'd be really interested in this type of mechanism in the WPG.

Any chance you've managed to implement it since you posted this? :-)


P.S. I'm very impressed with the WPG, thus far (but would really benefit from UITypeEditor-style functionality).

Aug 8, 2009 at 7:24 PM

Hi Kean,

As you may notice, this project is kind of a prototype or proof of concept. Unfortunately I don't have much time to move on.

But you may download the solution so far and extend it.

Aug 10, 2009 at 9:22 AM


I've been using the WPG in my own proof of concept application, and so have implemented a specific solution that works (but is far from being elegant/generic). So that's fine, for now.

One other item I've been struggling with is the ability to check or set selection/focus of individual properties. How best would you approach that? (Sorry for the basic question - I've worked with Winforms for several years but am on the steep part of the learning curve with WPF.)


Sep 3, 2009 at 8:42 AM
Edited Sep 3, 2009 at 8:44 AM

The old Winforms PropertyGrid supports custom TypeConverter such as:

[TypeConverter(typeof(DynamicConverter))] public object Value.

I have downloaded the solution and noticed that this functionality is not yet implemented.

Any chance that you could offer some pointers how to implement it.


P.S I'm very impressed with the WPG.

Sep 3, 2009 at 9:12 PM

Hi Kean,

I didn't receive an email for you comment, so forgive for this late respond.

To have focus, you may consider implementing the wpg using list box instead of items control.


Sep 3, 2009 at 9:56 PM

Hi wpflearner,

Yes, indeed I've uploaded a very first proff of concept, and didn't update it so far.

For your question regard DynamicConverter, you may use a value converter (IValueConverter) inside the data-template to convert the value to and from the property.


Sep 4, 2009 at 1:25 AM


I am converting an old Winforms app which uses the old PropertyGrid. The properties are dynamically created (via reflection) and the DynamicConverter is defined as class DynamicConverter : TypeConverter.

The class DynamicConverter overrides methods like CanConvertFrom, ConvertTo, etc which are called back in some pre-defined sequence (eg GetStandardValuesSupports, CanConvertForm, .. ) from the old Winforms PropertyGrid.

I am just wondering if there is a better way to implement this in WPF world.



Sep 4, 2009 at 8:39 AM

You can extract type TypeConverterAttribute attribute the same way as I extract the other designer attributes, create an instance from the type converter and activate it when the Value property changes two-way.


Sep 9, 2010 at 9:52 AM

This may be reviving a long dead thread but I found this article by Mindscape which may be of relevance: