Ticket Q501861
Visible to All Users

PropertyGridControl and ExpandoObject

created 12 years ago

how do I get the propertygrid to display a dynamic class (Expando, dictionary<string, object> where key=propertyname etc)
I have a class where there are a set off attributes stored in Xml. I want to use the PropertyGrid for editing these values.

What would you suggest. (I don't know the attributes names / type before hand, these need to created based on the xml)

Example XML

<Attributes>
<Name>Bob</Name>
<Age DataType='int'>67</Age>
<Gender>Male</Gender>
<HairStyle>Funky</HairStyle>
<DanceStyle>Disco</DanceStyle>
<Music>Average White Band</Music>
</Attributes>

Any help would be appreciated.

Comments (2)
Andrey K (DevExpress Support) 12 years ago

    Hello Moose,
    After research, we have come to the conclusion that it is difficult to solve this question based only on the provided information. If you could provide me with a sample project, it would be very helpful. I am looking forward to your response.
    Thanks,
    Andrew

    MR MR
    Martin Radvansky 12 years ago

      Hi,
      I have the same problem.
      I need use property grid control to edit an XML file or dictionary where is name and value.
      How I can do it.
      I need it for configuration some external plugins, where autor give config xml file
      Thanks for help

      Answers approved by DevExpress Support

      created 12 years ago (modified 6 years ago)

      [Updated]
      Starting with v19.1, PropertyGridControl can edit ExpandoObject out of the box.

      In previous versions, PropertyGridControl doesn't support ExpandObject. I have created a separate thread regarding this issue: S172053: Support ExpandoObject in PropertyGridControl. You can subscribe to its updates to be notified when we have any news. As a solution, you can use a dictionary in the PropertyGridControl, but it is necessary to implement the ICustomTypeDescriptor interface. I have created a sample project to demonstrate how to accomplish this task.
      Thanks,
      Alexander Rus

        Show previous comments (5)
        Alexander Russkov (DevExpress) 12 years ago

          It's OK, Martin. Thank you for your clarification. I have also transferred this issue to a separate thread: "Q379209: How to hide specific rows in the PropertyGridControl".
          Thanks,
          Alexander Rus

            hi, I can't open the sample you posted in vs2010, I get an incompatible error. Can you repost it?

            Alexander Russkov (DevExpress) 11 years ago

              Hello Moose,
              I have converted the project. You can also open it via the "*.csproj" file instead of "*.sln".
              Thanks,
              Alexander Rus

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.