I have a workaround for now until v2.4 is released.
In the Xaml, I define the Data Template as a resource with a key:
In the Xaml, I define the Data Template as a resource with a key:
<DataTemplate x:Key="NewValueTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Value}" />
<Button x:Name="_button"
Grid.Column="1"
Content="Add New"
Click="Button_Click"
Visibility="{Binding Value, Converter={StaticResource MyConverter}}"/>
</Grid>
</DataTemplate>
Then, in the code behind, I programmatically create a new EditorTemplateDefinition, set its TargetProperties, set its EditorTemplate to that resource, and add the EditorTemplateDefinition to the PropertyGrid's definitions:EditorTemplateDefinition def = new EditorTemplateDefinition();
def.TargetProperties.Add(typeof(MyCustomClass));
def.EditingTemplate = (DataTemplate)FindResource("NewValueTemplate");
propGrid.EditorDefinitions.Add(def);
This technique does not break the designer. I added the template definition when the Loaded event of the application is fired.