I have a datagrid that displays a list of custom objects. This list contains objects who’s properties are storing other objects:
class Survey
{
public int Id{get;set;}
public Answer ChosenAnswer{get;set;}
public Question SomeQuestion{get;set;}
}
Right now the grid simply gives me the type of the objects stored in Survey properties.
So if I have a list of Survey, for example, how would I go about binding columns of my data grid to properties of Answer?
Do I need to work with the BindingSource?
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = surveys;
dataGridView.DataSource = bindingSource;
Where surveys is the list..
Thanks!
If you implement a ToString for Answer and Question classes, those will be displayed in the column. Hope thats what you need.