Ticket Q536966
Visible to All Users

How do I show in a PropertyGrid properties from a list that contains a list of objects that identify the property itself?

created 11 years ago

Good morning, how can I create a property grid leaning on a vector of elements ?
Let me explain: I have a class ( MyPropertyItem ) that in my software that identifies a property. This class has 4 different properties :Name, Description , Category and Value
Other classes inherit from this class and through polymorphism override the Value property going to define the true type of the property (string , integer, datetime , …)
Using LayoutControl was simple to make sure that this allows me to change the various properties . (see attached screenshoot top )
I'd like to take advantage of PropertyGridControl to enhance the property's name , description, category but do not understand how you can do I can .
The documentation says to value the property " SelectedObject " , but my case is different . I have a list of properties List <MyPropertyItem> . If you check the list to the property " SelectedObject " rightly component automatically displays the list and detail of the view that in the "Value" property inserts the appropriate component to change. (see attached screenshoot bottom )
In summary :I have a list of items:list <MyPropertyClass>
the class contains properties that I use in propertygridcontrolName, Description , Category , Value
associating this list I get this:[ 0 ]- Name = [ Value of property]- Description = [ Value of Property]- Category = [ Value of Property]- Value = [ Value of Property][1 ]- Name = [ Value of property]- Description = [ Value of Property]- Category = [ Value of Property]- Value = [ Value of Property]… I would like to get :[ MypropertyClass [0].Name = [ Value of property MyProperty [0]. Value][ MypropertyClass . [1] Name = [ Value of property MyProperty . [1] Value]…
How can I do?
thanks

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hi,
I recommend that you create a class implementing the ICustomTypeDescriptor interface and use items in your collection as property descriptors. Please take a look at the following ticket that contains an example of an ICustomTypeDescriptor object working with the PropertyGridControl: Q501861: PropertyGridControl and ExpandoObject.
Thanks

    Show previous comments (1)
    Alex Chuev (DevExpress) 11 years ago

      You can expose them via the Category and Description property attributes. Override the Attributes property in your property descriptors to return the Category and Description attributes with required values. The PropertyDescriptor Class MSDN article demonstrates how to override the Attributes property.
      Let me know if you need additional assistance.

        Thank you. Now everything is ok

        Alex Chuev (DevExpress) 11 years ago

          I'm glad to hear this. You are welcome.

          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.