次のクラスがあることを想像してみましょう
public class Master
{
public string MasterName = "Something";
public List<Detail> details = new List<Detail>();
}
public class Detail
{
public string Foo = "Test";
}
次に、以下のコードを使用して、DataGridView に Details オブジェクトのコレクションを表示します。
DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
column.DataPropertyName = "Details.Foo";
column.HeaderText = "Foo header";
dgv.Columns.Add(column);
列はグリッドに表示されますが、値はありません