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

Problem upgrading property grid to latest version

3 Answers 90 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
HDC
Top achievements
Rank 1
HDC asked on 20 Mar 2012, 08:20 PM

I am using RadPropertyGrid in our project.

It was working fine in our application until we upgraded to version 2012.1.215.1050. Now i'm getting following error:

"ItemPropertyInfo descriptor is not supported"

This is the code that i'm using

PropertyDefinition pdef = new PropertyDefinition();
           if ((attrib as PropertyEditorAttribute).PropertyEditor != PropertyEditorEnum.TelerikDefault)
           {
               pdef = new PropertyDefinition(
               new ItemPropertyInfo(e.PropertyDefinition.DisplayName, typeof(string), null));
           }
           else if ((attrib as PropertyEditorAttribute).Name == "Font Style")
           {
               pdef = new PropertyDefinition(
               new ItemPropertyInfo(e.PropertyDefinition.DisplayName, typeof(FontStyles), null));
           }
 
           pdef.GroupName = group;
           pdef.DisplayName = name;
           pdef.Description = description;           
           pdef.EditorTemplate = dataeditor;                                                
           propertyGrid.PropertyDefinitions.Add(pdef);

I cannot find any indication in the documentation that something has changed. What is the equivalent for this code or how do i fix this?






3 Answers, 1 is accepted

Sort by
0
HDC
Top achievements
Rank 1
answered on 20 Mar 2012, 09:53 PM
I fugured out the problem is caused by the NULL value in the code:

pdef = new PropertyDefinition(
new ItemPropertyInfo(e.PropertyDefinition.DisplayName, typeof(FontStyles), null));


The <null> is not accepted anymore (it is the cause of the error), but i don't know what to put there and the documentation is quite useless concerning this particular topic.

Can anyone tell me how this "object" looks like? 

Best Regards,

Peter
0
Accepted
Maya
Telerik team
answered on 21 Mar 2012, 03:12 PM
Hi Peter,

You need to define your property definition as follows:

PropertyDefinition pdef = new PropertyDefinition();
        pdef.Binding = new Binding("LastName");
        pdef.DisplayName = "Last Name";
        pdef.Description = "Last Name";
        this.myPropertyGrid.PropertyDefinitions.Add(pdef);

You might try using the other constructor for PropertyDefinition and use PropertyInfo for a descriptor for example. However, my recommendation would be to follow the approach illustrated above with the default constructor. 

All the best,
Maya
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
HDC
Top achievements
Rank 1
answered on 21 Mar 2012, 09:32 PM
Thanks Maya
Tags
PropertyGrid
Asked by
HDC
Top achievements
Rank 1
Answers by
HDC
Top achievements
Rank 1
Maya
Telerik team
Share this question
or