This project has moved. For the latest updates, please go here.

PropertyGrid EditorTemplateDefinitions as Resources

Feb 10, 2016 at 3:37 PM
If I create a set of EditorTemplateDefinitions in a resource dictionary how can I then assign them to instances of the PropertyGrid?

At the moment I can define the DataTemplate section as a resource and then use it like this:
            <xctk:EditorTemplateDefinition EditingTemplate="{StaticResource FlowrateDataTemplate}">
                    <xctk:TargetPropertyType Type="{x:Type gcm:Flowrate}"/>
But that separates the data template definition from the types to which it is applicable. Is there a way that I can define the whole EditorDefinition as a resource and then assign it something like:
            <xctk:EditorTemplateDefinition Content="{StaticResource FlowrateDataTemplate}" />
Thus keeping together the data template and the types to which it applies?

The only reason I having to do this is the Flowrate type is a struct and the usual expandable object approach doesn't work correctly due to it being a value type. See other discussions about why that is.