I'm having some trouble binding to a dynamically created generic collection, I don't get the expanding icon for any rows, even though I double and triple checked the bindings, but my setup is a bit complex. This behavior happens when I'm creating the columns manually (GridViewDataColumn), when I use autogenerated columns the behavior is a bit different, but still not working.
The type of the collection is:
MyDataSourceGeneric<ElementType> :
IQueryable<ElementType>, IQueryable, IEnumerable, IEnumerable<ElementType>,
IOrderedQueryable<ElementType>, IOrderedQueryable
where ElementType will be a type generated at runtime which inherits a MyRecordBase, so instances of this collection are created by:
Type recordType = /*... generate type that inherits MyRecordBase .... */ ;
var genericDs = typeof(MyDataSourceGeneric<>);
var dsType = genericDs.MakeGenericType(recordType);
var queriable = (IQueryable)Activator.CreateInstance( /*.....*/ );
And this queriable is used as datasource of the TreeListView.
I experimented with 4 approaches to expose the Children, implemented as a property in the generated recordType: coerce to object, coerce to IEnumerable, coerce to IEnumerable<ElementType> and return a plain MyDataSourceGeneric<ElementType>; due to the fact that the ElementType is generated at runtime, the typed-collection properties need to be generated at runtime also.