This project has moved and is read-only. For the latest updates, please go here.

Property Grid + ExpandableObject

Jun 25, 2012 at 12:56 PM
  public class Person
        {
            [Category("Information")]
            [DisplayName("First Name")]
            [Description("This property uses a TextBox as the default editor.")]
            public string FirstName { get; set; }

            [Category("Conections")]
            [Description("This property is a complex property and has no default editor.")]
            [ExpandableObject]
            public Address address { get; set; }
        }

public Class Address
{
public State { get; set;}
public Country {get;set;}
}

I have a problem while adding Person object as selected object to the propertygrid.
The expandable object is not working. Even it is not recognised while compilation. I need to know
the reason for the build failure.


Any comments about it?
Thanks in Advance,
Nadal
Coordinator
Jun 27, 2012 at 7:04 PM

Hi,

 

I do not experience the problem you have on my side.  However, I had to change a few things in your Address class to make it compile.

 

public class Address
{
  public string State
  {
    get;
    set;
  }
  public string Country
  {
    get;
    set;
  }
}

 

The ExpandableObject attribute is defined in the following namespace: Xceed.Wpf.Toolkit.PropertyGrid.Attributes.  Have you put the appropriate "using" statement at the beginning of your file?