Hello,
In my PropertyGrid, I want to set "UseDisplayAttributes" to true for all my all my enum editors.
Currently, I'm using this code:
<grids:PropertyEditor PropertyType="sys:Enum">
<grids:PropertyEditor.ValueTemplate>
<DataTemplate>
<editors:EnumEditBox Value="{Binding Value}" UseDisplayAttributes="True" />
</DataTemplate>
</grids:PropertyEditor.ValueTemplate>
</grids:PropertyEditor>
It does the job except when I use nullable enums, the editor no longer uses the "Description" attribute.
So i tried :
PropertyType="{shared:Nullable {x:Type sys:Enum}}"
But i get a TypeLoadException : GenericArguments[0], 'System.Enum', on 'System.Nullable`1[T]' violates the constraint of type 'T'.
Currently, on nullable enums, I'm using the following code, but I need to do it for each enum I want to use:
PropertyType="{shared:Nullable {x:Type mysNamespace:MyEnum}}"
Is there a better solution to force "UseDisplayAttributes" on all my EnumEditBox of my PropertyGrid ?
Thanks.
Benjamin.