PropertyGrid does not support inheritance

11 posts, 0 answers
  1. Terrence
    Terrence avatar
    4 posts
    Member since:
    Sep 2011

    Posted 05 Mar 2012 Link to this post

    Below are some class definitions.  My property grid is named pg

    pg.Item = new Parent { Child = new ConcreteChild() };

    The property grid will show the Child Property, the displayname attribute is ignored and only properties of the ancestor class are shown.  If I trap the AutoGeneratingPropertyDefinition event the PropertyType shows as AbstractChild.  It appears the propertygrid is not looking at the instance type of the property.

    If I bind directly to an instance of type ConcreteChild, I get all the properties. 

    pg.Item = new ConcreteChild(); //this works 



        public class Parent
        {
            public AbstractChild Child { get; set; }
        }
        public abstract class AbstractChild
        {
            public string Name { get; set; }
        }

        [DisplayName("Concrete Child")]
        public class ConcreteChild : AbstractChild
        {
            [DisplayName("New Property")]
            public String NewProperty { get; set; }
        }
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 06 Mar 2012 Link to this post

    Hi Andrew,

    I have just posted an answer in the other support thread you have opened. The issue will be fixed with our next internal build. Please, let me thank you again for the valuable feedback.

    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. UI for WPF is Visual Studio 2017 Ready
  4. Michael
    Michael avatar
    2 posts
    Member since:
    Feb 2012

    Posted 17 Apr 2012 Link to this post

    I believe I too am experiencing the same issue, but am not sure.   I am using the PropertyGrid for a class that looks something like the following 

    MyClass
    {
    Public String PropertyA;
    Public String PropertyB;
    Public MyBase PropertyC
    }

    Where the value in PropertyC is a subclass of MyBase.

    The PropertyGrid does not resolve PropertyC as having a nested property. The result is that I do not see the nested property values for my sub-classed instance assigned to PropertyC.
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 17 Apr 2012 Link to this post

    Hello Michael,

    Would you please confirm which version of RadControls you are currently using? This feature should be supported with our newer versions.

    Regards,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  6. Michael
    Michael avatar
    2 posts
    Member since:
    Feb 2012

    Posted 17 Apr 2012 Link to this post

    I am not in front of my work computer... so I dont know exactly what revision we are on..  But we just downloaded the lastest eval version of the WPF contols last week. I will say this.. we are using the Assembly, Module, and Type builders to generate dynamic copies of our data contracts so that we can easily bind them to the PropertyGrid.   I dont know if this makes any difference.
  7. Michael C
    Michael C avatar
    6 posts
    Member since:
    Apr 2012

    Posted 23 Apr 2012 Link to this post

    Ivan
    We are using Q1 2012 release, build 326 of the WPF controls. Do yo know if there is a bug in handling of subclassed Nested Property elements?  
  8. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 23 Apr 2012 Link to this post

    Hello Michael,

    I have tested a similar scenario with the version that you have mentioned - 2012.1.326.40, but with no success in reproducing such an issue. I am attaching my test project for your reference. Would you please share with us whether there are any significant differences between my approach and yours?

    All the best,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  9. Michael C
    Michael C avatar
    6 posts
    Member since:
    Apr 2012

    Posted 24 Apr 2012 Link to this post

    Ivan 

    I changed your code to more closely model what we are trying to do and it still does not work. See my changes below:

     public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
                rpg.Item = new MyClass()
                {
                    NestedProperty = new MySubClass() { A = 1, B = 2 }
                };
            }
        }

        public abstract class MyBaseClass
        {
            public Guid ID { get; set; }

        }

        public abstract class MySubBaseClass
        {


        }

        public class MyClass : MyBaseClass
        {
            public MySubBaseClass NestedProperty { get; set; }
        }

        public class MySubClass: MySubBaseClass
        {
            public int A { get; set; }
            public int B { get; set; }
        }

    We are using Q1 2012 release, build 326
  10. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 25 Apr 2012 Link to this post

    Hi,

    We have managed to reproduce this issue applying the modifications that you have mentioned. We will do our best to fix it with next week's internal build.

    Greetings,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  11. Michael C
    Michael C avatar
    6 posts
    Member since:
    Apr 2012

    Posted 08 May 2012 Link to this post

    What is the status of this fix?  Is there a way we can get the update and try this again?
  12. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 14 May 2012 Link to this post

    Hello,

    Unfortunately this issue has appeared to need some additional effort for finding an appropriate fix. As some more complex internal changes would be needed, the fix has been scheduled for the official release that will be available in the beginning of the next month. Please excuse us for this inconvenience.

    All the best,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top
UI for WPF is Visual Studio 2017 Ready