This is a migrated thread and some comments may be shown as answers.

DropDownListEditor for Enum: Change display text

3 Answers 203 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 11 Aug 2017, 08:29 PM

I have a complex object and one of the variables is an enum. When I assign the object to the PropertyGrid's selected item, it generates a DropDownListEditor for the enum row correctly. However, the display text is automatically the ToString of the enum, which is not ideal for users to see and read. I want to change the display text to be the Description tagged to the enum values but I can't figure out a way to change what the DropDownListEditor displays or to update the values databound to the dropdown to achieve what I want.

 

public enum ExposureMode
    {
        [Description("Full Auto")] FullAuto,
        [Description("Auto Filter, Fixed Exposure")] AutoFilFixedExp,
        [Description("Fixed Filter, Auto Exposure")] FixedFilAutoExp,
        [Description("Fixed Filter, Fixed Exposure")] FullFixed
    }

 

So I want the Descriptions to be displayed instead of the ToString (i.e. "Auto Filter, Fixed Exposure" instead of AutoFilFixedExp).

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 14 Aug 2017, 07:52 AM
Hello Jay, 

Thank you for writing.  

I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, feel free to use the suggested solution in the referred item.

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Tino
Top achievements
Rank 1
answered on 06 Sep 2017, 06:41 AM

I've just done this for several enum types. You need a TypeConverter for each enum type, which is documented in the Telerik docs.

However, despite appearances being good, when I change the dropdown selection it does not propagate back to my object's property for some reason, even after pressing Enter.

Does anyone know why this might be?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Sep 2017, 06:26 AM
Hello Tino, 

Thank you for writing.  

Each property item is associated with a specific property from the SelectedObject in RadPropertyGrid. If the TypeConverter is implemented correctly, it is not supposed to experience any undesired behavior. Could you please specify the exact steps how to reproduce the problem? A better option would be to submit a support ticket where you can provide a sample project demonstrating the issue. Thus, Telerik support will gladly assist you in resolving this case.

I hope this information helps. 

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
PropertyGrid
Asked by
Jay
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Tino
Top achievements
Rank 1
Share this question
or