I am trying to databind a DataGridView to a list that contains a class with the following structure:
MyClass.SubClass.Property
You can add a handler to DataBindingComplete event and fill the nested types there. Something like this:
in form_load:
dataGridView.DataBindingComplete += new DataGridViewBindingCompleteEventHandler(dataGridView_DataBindingComplete);
later in the code:
void dataGridView_DataBindingComplete(object sender,
DataGridViewBindingCompleteEventArgs e)
{
foreach (DataGridViewRow row in dataGridView.Rows)
{
string consumerName = null;
consumerName = ((Operations.Anomaly)row.DataBoundItem).Consumer.Name;
row.Cells["Name"].Value = consumerName;
}
}
It isn't nice but works.