Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
Binding XamGrid to a CompositeCollection containing different ViewModels
posted

I need to bind a XamGrid to a CompositeCollection containing different ViewModels (which actually have similar named properties).
Only the similar named columns are visible.

Showing ViewModels of the same type is no problem, but in the moment I add another viewmodel type, the Xamgrid crashes with an error message
starting like:

The object of type "AViewModel" cannot be casted to "BViewModel"

atSystem.Linq.Enumerable.<CastIterator>d__1`1.MoveNext()

atSystem.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()

atSystem.Linq.Enumerable.Count[TSource](IEnumerable`1 source)

at Infragistics.DataManager`1.ResolveCount()
...

Is it even possible to use different ViewModels as ItemsSource?
The rows need to be sortable as well.
There seems to be no example code where such scenario is achieved.
Somewhere in the forums, I read about the need of implementing IComparable on the viewmodels, but there seems to be no example code either.


Thanks and best regards,
Nils 

 

Parents
No Data
Reply
  • 16495
    Offline posted

     

    Hello,

     

    Thank you for your post.

     

    I have been looking into the functionality you are looking for and it seems that currently our XamGrid control is not design to show heterogeneous data. What I can suggest is to take a look at the following forum thread, where a similar question was discussed:

     

    http://es.infragistics.com/community/forums/t/92761.aspx

     

    Please let me know if you require any further assistance regarding this matter.

Children
No Data