Hi,
You can use an EditorTemplateDefinition to specify which editor a property will get :
You can use an EditorTemplateDefinition to specify which editor a property will get :
<Window.Resources>
<local:Holder x:Key="myListOfTypes" />
</Window.Resources>
<Grid>
<Grid>
<StackPanel>
<xctk:PropertyGrid x:Name="_propertyGrid">
<xctk:PropertyGrid.EditorDefinitions>
<xctk:EditorTemplateDefinition TargetProperties="Outline">
<xctk:EditorTemplateDefinition.EditingTemplate>
<DataTemplate>
<xctk:CollectionControlButton ItemsSource="{Binding Value}"
NewItemTypes="{Binding Source={StaticResource myListOfTypes}, Path=Types}"/>
</DataTemplate>
</xctk:EditorTemplateDefinition.EditingTemplate>
</xctk:EditorTemplateDefinition>
</xctk:PropertyGrid.EditorDefinitions>
</xctk:PropertyGrid>
</StackPanel>
</Grid>
</Grid>
public class Holder
{
public List<Type> Types
{
get;
set;
}
public Holder()
{
Types = new List<Type>();
Types.Add( typeof( MyCircle ) );
Types.Add( typeof( MyRectangle ) );
}
}