DropDownListEditor for Enum: Change display text

4 posts, 0 answers
  1. Jay
    Jay avatar
    2 posts
    Member since:
    Jan 2017

    Posted 11 Aug Link to this post

    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).

  2. Dess
    Admin
    Dess avatar
    2110 posts

    Posted 14 Aug Link to this post

    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.
  3. Tino
    Tino avatar
    37 posts
    Member since:
    Jul 2017

    Posted 06 Sep in reply to Jay Link to this post

    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?

  4. Dess
    Admin
    Dess avatar
    2110 posts

    Posted 08 Sep Link to this post

    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.
Back to Top