This is a migrated thread and some comments may be shown as answers.

PropertyGrid does not support inheritance

10 Answers 147 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Terrence
Top achievements
Rank 1
Terrence asked on 05 Mar 2012, 05:44 PM
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; }
    }

10 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 06 Mar 2012, 04:58 PM
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 >>
0
Michael
Top achievements
Rank 1
answered on 17 Apr 2012, 07:57 PM
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.
0
Ivan Ivanov
Telerik team
answered on 17 Apr 2012, 10:11 PM
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 >>
0
Michael
Top achievements
Rank 1
answered on 18 Apr 2012, 12:39 AM
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.
0
Michael C
Top achievements
Rank 1
answered on 23 Apr 2012, 02:40 PM
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?  
0
Ivan Ivanov
Telerik team
answered on 23 Apr 2012, 04:16 PM
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 >>
0
Michael C
Top achievements
Rank 1
answered on 24 Apr 2012, 09:34 PM
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
0
Ivan Ivanov
Telerik team
answered on 25 Apr 2012, 11:21 AM
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 >>
0
Michael C
Top achievements
Rank 1
answered on 08 May 2012, 12:50 PM
What is the status of this fix?  Is there a way we can get the update and try this again?
0
Ivan Ivanov
Telerik team
answered on 14 May 2012, 07:03 AM
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 >>
Tags
PropertyGrid
Asked by
Terrence
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Michael
Top achievements
Rank 1
Michael C
Top achievements
Rank 1
Share this question
or