Is there a way to bind the child properties of an object to datagridview? Here's my code:
public class Person
{
private string id;
private string name;
private Address homeAddr;
public string ID
{
get { return id; }
set { id = value; }
}
public string Name
{
get { return name; }
set { name = value; }
}
public Address HomeAddr
{
get { return homeAddr; }
set { homeAddr = value; }
}
}
public class Address
{
private string cityname;
private string postcode;
public string CityName
{
get { return cityname; }
set { cityname = value; }
}
public string PostCode
{
get { return postcode; }
set { postcode = value; }
}
}
And I want to show ID, Name, CityName when an object of the type Person is binded to datagridview. Note that CityName is a property of HomeAddr.