wpftoolkit
wpftoolkit copied to clipboard
PropertyGrid - Is it possible use the Attribute Description in Enums?
Hi developers, a question:
is it possible, in a PropertyGrid, to display the Description attribute of an Enum in the ComboBoxitems instead of displaying the name?
public enum ExampleEnum
{
[Description("First Item")] // Use that
FirstItem = 1, // Instead of that
[Description("Second Item")]
SecondItem = 2,
[Description("Third Item")]
ThirdItem = 3
}
Here is a reference link that describes my question: https://code.4noobz.net/wpf-enum-binding-with-description-in-a-combobox/
Any help is greatly appreciated.
Hi, I think what you want is already available in the Plus version of the Toolkit. If you start the LiveExplorer, available here https://xceed.com/en/our-products/product/toolkit-plus-for-wpf, and you test the sample PropertyGrid/UsingSelectedObjects/Localization, it will show the ExtendedDisplayName attribute from an enum values. The affected enum is ActorWithDisplayName. You can see the code in the Code tab from the LiveExplorer sample.
You can try the Plus version for free for 45 days. Thank you.