Databinding an IEnumerable type to DataGrid?

  • Thread starter Thread starter cody
  • Start date Start date
C

cody

What do I have to do if I want to Databind an IEnumerable to a Datagrid?
I have a datagridtablestyle in the datagrid but I don't know what the
MappingName should be. For the DatagridBoolColumns I've set the mappingnames
to the properties of the class which the IEnumerable class yields.

myDataGrid.DataSource = myEnumerable;
myDataGrid.Refresh();

If I open the Form the grid is still empty. Additionally GetEnumerator() of
my class is not called.
 
I only implemented IEnumerable because I just wanted readonly view.
I now changed it this way that I inherit from ArrayList and now it works :)
There is still a lot to learn about databinding and I find Databinding one
of the most complicated things in .NET.
 
Back
Top