Hi...
I want to undestand how DataTable works when it presents data on a DataGrid.
So:
1. DataTable have 2 collections that interest me:
> Columns
> Rows
2. DataRow object have only one constructor and its pivate.
This means that this object can only be created thru Reflection.
3. Inspecting a DataRow object at run-time, it seems that this object is, in fact, a collection, from where we van retrieve data thru index or name.
4. Now... How can we have a collection (Rows) witch each item is a collection (DataRow) and still the DataGrid can grab the column name and put it on the column header and grab the value and put it on the cell?
The closest I came to this scenario was to have a collection that implements IListSource and its items be a class with public properties.
This way, the DataGrid picks the property name as the column header caption and the property value for the cell...
This isnt quite the same, cause then I cant change the ColumnName like I can on the DataTable structure...
It seems that it gets the schema from the Columns collection and the data from the Rows collection... but how can this be donne?
Thanks in advance!
Alex
I want to undestand how DataTable works when it presents data on a DataGrid.
So:
1. DataTable have 2 collections that interest me:
> Columns
> Rows
2. DataRow object have only one constructor and its pivate.
This means that this object can only be created thru Reflection.
3. Inspecting a DataRow object at run-time, it seems that this object is, in fact, a collection, from where we van retrieve data thru index or name.
4. Now... How can we have a collection (Rows) witch each item is a collection (DataRow) and still the DataGrid can grab the column name and put it on the column header and grab the value and put it on the cell?
The closest I came to this scenario was to have a collection that implements IListSource and its items be a class with public properties.
This way, the DataGrid picks the property name as the column header caption and the property value for the cell...
This isnt quite the same, cause then I cant change the ColumnName like I can on the DataTable structure...
It seems that it gets the schema from the Columns collection and the data from the Rows collection... but how can this be donne?
Thanks in advance!
Alex