AdamRobinson wrote:
I have to question that last portion of your post because of one issue: if that is true, then they could never bind to a DataView.
Sure it can, because it tests for a dataview.
Look, by the book every grid or other control in complex binding, has to use ITypedList, the property descriptors returned and what not. In practise, this isn't the case sadly enough. Just search on infragistics and 'hang' on this forum and you'll be presented by examples .
They get better in respect to working with the standard way of doing things, but don't expect every grid does this. I had that hope as well, several years ago, but since then I learned the hard way that often reality is different: grids do all kinds of things to get binding to work, and often use special case code for datasets/views/tables and other code for collections, while it shouldn't make a difference.
The actual objects in a DataView are DataRowView objects, which do not have explicitly declared properties for each column, so reflection alone would fail to find a property for any column, and the grid wouldn't display any data. I fail to see a way that you could bind to something generic like the DataView without playing nice with the PropertyDescriptor paradigm.
if(_dataSource is DataView)
{
// use dataview code
}
else
{
// use other code
}
and this is real. Grids get the properties using ITypedList.GetItemProperties, and llblgen pro implements that, and you can alter the behavior as I described. However, just as an example, UltraGrid from infragistics doesn't use ITypedList to get the properties, it adds a new instance to the collection and reflects on it. This hangs up selfservicing apps for example because the reflection triggers lazy loading if they reflect multiple bands in one go.
We did everything we could to prevent this by implementing ITypedList, IBindingList and what not, but some simply won't use it. Their latest versions seem to be alittle friendlier, but earlier versions (2004.x for example) aren't. It was a surprise for me too, because why 2 codebases if you can do everything with ITypedList
Oh, and the columns in a grid can also be retrieved from the related datatable's datacolumn collection, without property descriptors. Several report generators use that kind of technique to work with a bound datasource, instead of working with ITypedlist so everything would work out of the box.