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
40
XamGrid with ObservableCollection<MyInterface>
posted

I have a XAMGrid bound to ObservableCollection<MyObject>.  MyObject contains a number of fields including one field that is ObservableCollection<MyInterface>.  MyInterface defines several properties, including a property Rows of type ObservableCollection<Object>.  I have a few different classes that implement MyInterface, each implementing the Rows property with its own underlying object. 

 

In XML, I have  

 

<ig:XamGrid Name="myGrid" ItemsSource="{Binding Source={StaticResource MyObject}, Path=objects}"

<ig:TextColumn Key="objectAttr1" />

<ig:TextColumn Key="objectAttr2" />

<ig:ColumnLayout Key="MyInterfaceObservableCollection" >

<ig:ColumnLayout.Columns>

<ig:TextColumn Key=" interfaceProp1" />

<ig:TextColumn Key=" interfaceProp2" />

<ig:ColumnLayout AutoGenerateColumns="true" Key="Rows" >

</ig:ColumnLayout>

</ig:ColumnLayout.Columns>

</ig:ColumnLayout>

<ig:XamGrid />

 

The grid displays and has the expected hierarchy of child bands.  All objectAttr* columns and interfaceProp* columns display properly.  When I expand the first Rows child band that implements MyInterface, it expands and displays the correct columns with the correct headers as defined in attributes of the underlying object.  The problem I encounter is that when I expand the next Rows child band that implements a different underlying object, I see the columns from the first object and none of them are populated.  If I refresh the page and open the Rows child bands in a different order, I always get the child band columns for the first Rows child band that I expand.

 

I would like to bind a XamGrid to an ObservableCollection<MyInterface> that returns differing rows and be able to see the appropriate columns for the different implementations of MyInterface.  Is this possible?

Parents
No Data
Reply Children
No Data