Problem upgrading property grid to latest version

4 posts, 1 answers
  1. HDC
    HDC avatar
    214 posts
    Member since:
    Dec 2010

    Posted 20 Mar 2012 Link to this post

    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?






  2. HDC
    HDC avatar
    214 posts
    Member since:
    Dec 2010

    Posted 20 Mar 2012 Link to this post

    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
  3. DevCraft banner
  4. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 21 Mar 2012 Link to this post

    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 >>
  5. HDC
    HDC avatar
    214 posts
    Member since:
    Dec 2010

    Posted 21 Mar 2012 Link to this post

    Thanks Maya
Back to Top