PropertyGrid don't show all properties

Jan 2, 2013 at 2:33 PM

Hello

I'm using the propertygrid for a xaml editor. The performance is very good! But the propertygrid don't show all properties of the selected object.

E.g.: If I set the "SelectedObject" to a grid: the property "Width" is shown correctliy, but "Height" (and other properties) are not visible.

I have tried to create my own propertydefinitions by reflection, but same result...

What am I doing wrong?

Jan 9, 2013 at 7:25 AM

Check if target property is public and has getter/setter. Following code works fine for me :

PropertyGrid1.AutoGenerateProperties = false;

PropertyGrid1.ShowProperties(new[] { "DateTime", "GPSLatitude", "GPSLongitude" });

..

public static class PropertyGridExtensions

{

  public static void ShowProperties(this PropertyGrid propertyGrid, string[] propertyNames)       

  {

      var pdc = new PropertyDefinitionCollection();           

      foreach (var pd in propertyNames.Select(propertyName => new PropertyDefinition {Name = propertyName}))           

     {               

           pdc.Add(pd);           

     }

     propertyGrid.PropertyDefinitions = pdc;       

 }   

}

Jan 10, 2013 at 4:55 PM

This should be fixed in version 1.9 (release 2013-01-14)