PropertyGrid for a List Property

7 posts, 0 answers
  1. Wenhao
    Wenhao avatar
    17 posts
    Member since:
    Jan 2012

    Posted 08 Mar 2012 Link to this post

    Hi,
    I am now using this RadPropertyGrid control for my current project, and it's a really fantastic tool that makes some of my jobs relieved. But I have got stuck now, as we have a model class show as follow:

    I will need the properties in the nested ModelItem class to be displayed, just like Name..., but what i got is some properties of the type List<T>, that's not I expected.

    I wan wondering how could I got the properties of items in an array or a list, just like RadTreeListView? Or is there a special workaround?
    public class Model{<BR>public List<ModelItem>
    List{get;set;}<BR>}<BR>public class ModelItem<BR>{<BR>public string
    Name{get;set;}<BR>}<BR>
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 08 Mar 2012 Link to this post

    Hello Wenhao,

    Thank you for your kind words and valuable feedback. RadPropertyGrid does not provide a default editor for collection type properties yet. However, we have planned to introduce a native collection editor control for RadPropertyGrid with our next Q release. The current recommended approach is to use custom editor template for the field that is bound to the collection property. Please, let us know if you have met any obstacles while implementing this.

    Kind regards,
    Ivan Ivanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Wenhao
    Wenhao avatar
    17 posts
    Member since:
    Jan 2012

    Posted 08 Mar 2012 Link to this post

    Hi Ivan,

    Thanks for this timely reply and your kind suggestions. However, as we discussed previously, we would prefer the List<T> field to be displayed like a nested property of the host type, I mean how could we do custom the label column via implementing a custom editor template. Sorry but I am still confused on this. Could you help deliver a brief demo or some code sample?

    Your time and effort on this are really appreciated.

    Regards,
    Wenhao
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 09 Mar 2012 Link to this post

    Hello Wenhao,

    Unfortunately RadPropertyGrid's nested properties feature purpose is a bit different. It is designed to display and process hierarchies of CLR types, not collections of items, so that currently there is no clean approach to accomplishing this task. However, we are going to introduce a minor change in RadPropertyGrid's NestedProperties binding logic with Q1's service pack, of which your scenario would benefit. Would you please confirm whether it is an option for you to wait for several days for our SP release? If so, I will contact you, as soon as it is available for our clients, providing you and example illustrating how to achieve this.

    Kind regards,
    Ivan Ivanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Wenhao
    Wenhao avatar
    17 posts
    Member since:
    Jan 2012

    Posted 09 Mar 2012 Link to this post

    Hi Ivan,

    Thank you for your detailed update on this thread. It would be a little bit regretful that PropertyGrid does not introduce a built-in approach currently. As for now, we generate an IL type dynamically at runtime via reflection to accomplish temporarily, whereas runtime performance and stability are also important. We are still looking forward to the next service pack of Q1 to make it smoothly.

    Thank you for your time on this.

    Regards,
    Wenhao
  7. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 12 Mar 2012 Link to this post

    Hello Wenhao,

    Please, let me thank you for your patience. I will keep in touch with you, in order to contact you as soon as the SP is released. I will do my best to prepare a demo project for you by then.

    Kind regards,
    Ivan Ivanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  8. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 15 Jun 2012 Link to this post

    Hello,

    With the recently released Q2 version of RadControls, RadPropertyGrid can edit IEnumerable type-compatible properties utilizing the new CollectionEditor control.

    Regards,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top
DevCraft banner