I'm trying to use Xceed PropertyGrid to show dropdown with hardcoded string values.
Instead of showing the items as the strings I assign as the IItemSource
, PropertyGrid showing: "Xceed.Wpf.Toolkit.PropertyGrid.Attributes.Item" for each item in the dropdown.
When I select an object, the desired string is showing as the chosen item.
This is the dropdown items I see:
And when I choose an item, I can see it the way I want it to appear as the dropdown items as well:
My code:
XAML:
<xctk:PropertyGrid SelectedObject="{Binding MySettingsWrapper}" AutoGenerateProperties="True">
</xctk:PropertyGrid>
C#:
[Serializable]
public class SettingsWrapper
{
[LocalizedCategory("SettingsViewCategoryHardware")]
[LocalizedDisplayName("SettingsViewLblSelectPrinter")]
[ItemsSource(typeof(PrintersItemSource))]
public string SelectedPrinter { get; set; }
public class PrintersItemSource : IItemsSource
{
public ItemCollection GetValues()
{
var printers = new ItemCollection();
for (int i = 0; i < 7; i++)
{
printers.Add("Option - " + i);
}
return printers;
}
}
}
I'm using Caliburn.Micro, BTW.
I've tried several things and I'm out of ideas. Any help is appreciated.