wpfmarginpropertygridwpf-extended-toolkit

Propertygrid: create custom property definition based on Margin target property


I'm using the Extended WPF Toolkit's PropertyGrid. For the margin target property I would like to divide it from (0,0,0,0) to four separate fields with words or arrows, similar how it is in Visual Studio. My xaml looks like this:

            <extToolkit:PropertyDefinition TargetProperties="Margin"/>

Current visual appearance:

Current visual appearance

Desired visual appearance:

Desired visual appearance


Solution

  • Not quite what you asked, but something easy you can do is setting the IsExpandable property to true, like so...

    <extToolkit:PropertyDefinition TargetProperties="Margin" IsExpandable="true" />
    

    That forces the PropertyGrid to expand out the object at that property.

    However, if you want to do the editor the way you have it, you have to create a custom editor for that specific property. You do that by associating your own templates for the editor. Since it looks like something that may be reusable, I would design that as a control, then use that control as the editor.