Binding multiple types to a DataGrid

Posts   
 
    
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 03-May-2009 20:20:15   

Hi,

I'm trying to bind an EntityCollection to a DataGrid using the 'LlblGenDataSource'. When the collection contains multiple types from an inheritence hierarchy, if a derived type comes first in the list then the DataGrid refused to bind any subsequent base types. Any ideas how I can get this to work? I tried wrapping all the items in the collection in a single type but there doesn't seem to be anyway to grab hold of the retrieved collection before its bound.

Cheers, Ian.

Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 03-May-2009 21:57:19   

I got it working! smile smile smile

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-May-2009 22:22:44   

Nice!

Could you share it with us simple_smile , that way other people would be benefited?

David Elizondo | LLBLGen Support Team
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 04-May-2009 22:45:00   

Well its no big secret that with LLBLGenDataSource2 you can add a bit of code to 'PerformWork' to wrap the returned elements each in their own Adapter. The problem I had was that the 'PerformWork' handler is inside a framework so it wasn't so easy to customize it for just one type of collection. So I just added a hook into the framework inside 'PerformWork' so that any list could wrap all its elements in an Adapter right after they've been returned.

I have the Adapter returning default values for derived class properties when it wraps a base class instance.

Hope that makes sense!