How do I get a grid control to see MyDataView's column definitions?
-
I have implemented my own MyDataView so that I can process the raw data before it appears in a data grid. MyDataView implements IBindingList. MyDataView has a collection of MyDataRow objects. MyDataRow implements ICustomTypeDescriptor. MyDataView also has a collection of MyDataColumn objects, which it shares with the MyDataRow objects. MyDataRow exposes the collection of MyDataColumn through the ICustomTypeDescriptor interface. When assigning the DataSource property of the grid to an instance of MyDataView, it displays all the columns and rows correctly, as long as there is at least one row of data to display. However, when the MyDataView has no rows, the grid shows a single column called "Column" instead of the actual columns in the collection. This makes sense to me since the columns are exposed through the row, and there are no rows. Somehow, I need the grid to see MyDataView's column definitions even if there are no rows in the view. I tried modifying MyDataView to also implement ICustomTypeDescriptor, but it did not seem to have any effect. How do I get a grid to see MyDataView's column definitions even if there are no rows in the view? (I'm using the DevExpress.XtraGrid.GridControl from Developer Express.)