Hi,
I am trying to implement an editable combobox inside of my propertygrid and I am stuck on a couple of issues. I have the following XAML code to make the combobox editable:
For my next issue, I have the following C# code that the property "MyValues" uses for it's item source:
Thank you for the help!
I am trying to implement an editable combobox inside of my propertygrid and I am stuck on a couple of issues. I have the following XAML code to make the combobox editable:
<xctk:PropertyGrid x:Name="PropertyGrid" Width="450" Margin="10">
<xctk:PropertyGrid.EditorDefinitions>
<xctk:EditorDefinition>
<xctk:EditorDefinition.PropertiesDefinitions>
<xctk:PropertyDefinition Name="MyValues"/>
</xctk:EditorDefinition.PropertiesDefinitions>
<xctk:EditorDefinition.EditorTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Value}" IsEditable="True"/>
</DataTemplate>
</xctk:EditorDefinition.EditorTemplate>
</xctk:EditorDefinition>
</xctk:PropertyGrid.EditorDefinitions>
</xctk:PropertyGrid>
As far as I know, this XAML will look for a property named "MyValues" and give it an editable combobox in the propertygrid. This seems to work fine until I set the ItemsSource attribute on the MyValues property. Setting the ItemsSource attribute seems to overwrite my editable combobox and it instead replaces it with the default combobox.For my next issue, I have the following C# code that the property "MyValues" uses for it's item source:
public class MyValuesItemsSource : IItemsSource
{
public Xceed.Wpf.Toolkit.PropertyGrid.Attributes.ItemCollection GetValues()
{
Xceed.Wpf.Toolkit.PropertyGrid.Attributes.ItemCollection values = new Xceed.Wpf.Toolkit.PropertyGrid.Attributes.ItemCollection();
values.Add("one");
values.Add("two");
return values;
}
}
This seems to also work fine, but how do I add to this ItemsSource at run time? Say something happens during the course of the program and I want to add another option to the combobox (perhaps "three"), or I want to remove one of the options, how is this done?Thank you for the help!