How to pass an XML with a list of values to RADPropertyGrid?

1 Answer 31 Views
PropertyGrid
Deeron
Top achievements
Rank 1
Deeron asked on 01 Jul 2022, 12:57 PM

Hello,
I am getting to know the RADPropertyGrid control, it seems flexible.
I have an XML file where "Key" would be the property name and "Value" would be the value in RADPropertyGrid. Where required, I also have a value list between the "ValueList" element. My question is, how can I pass the XML so that the value list for that element is displayed as a string in a combobox in the RADPropertyGrid associated with the property?

Can you show me a sample project on how to do this?

Sample XML:

<PictureBox>
    <Property>
        <Key>EnableClickZoom</Key>
        <Value>False</Value>
    </Property>
    <Property>
        <Key>EnableZoom</Key>
        <Value>False</Value>
    </Property>
    <Property>
        <Key>EnableAutoPan</Key>
        <Value>False</Value>
    </Property>
    <Property>
        <Key>SizeMode</Key>
        <Value>Fit</Value>
        <ValueList>
            <Value>Normal</Value>
            <Value>Stretch</Value>
            <Value>Fit</Value>
        </ValueList>
    </Property>
    <Property>
        <Key>Zoom</Key>
        <Value>30</Value>
    </Property>
    <Property>
        <Key>InterpolationMode</Key>
        <Value>Default</Value>
        <ValueList>
            <Value>Default</Value>
            <Value>Low</Value>
            <Value>High</Value>
            <Value>Bilinear</Value>
            <Value>Bicubic</Value>
            <Value>NearestNeighbor</Value>
            <Value>HighQualityBilinear</Value>
            <Value>HighQualityBicubic</Value>
        </ValueList>
    </Property>
</PictureBox>

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 05 Jul 2022, 02:05 PM

Hello Deeron,

The question in this thread is duplicated to a ticket logged from your account. I have already posted an answer on the other ticket. I will share it here so that the community can take advantage of it.

I will start with that the control does not provide such an option out of the box. You will need to create custom code to deserialize the XML and read its values. I have searched the web and came across the following Deserialize Key-Value pair XML to Class object StackOverflow thread. So far I was able to use one of the suggestions to deserialize the values. However, the tricky part comes from the ValueList element and its values inside. I wasn't able to get them correctly. Only the first element is returned in the ValueList. Still, you can check the attached project to see what I have implemented so far. Could it be possible in your application to create enum objects based on the values inside the ValueList? Check the project and share your thoughts here.

As a side note, place the XML file in the bin folder.

Regards,
Dinko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PropertyGrid
Asked by
Deeron
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or