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
60
Xamgrid and heterogeneous collections
posted

I have the following class hierarchy (pseudocode):

BaseClass

DerivedClass1 : BaseClass

DerivedClass2 : BaseClass

I have a heterogeneous collection of BaseClass items that contains DerivedClass1 and DerivedClass2 items. When I bind this collection to a xamgrid and specify columns in xamgrid columns as following:

<ig:XamGrid
x:Name="XamGrid_Mygrid" d:DataContext="{d:DesignInstance viewModel:BaseClassListViewModel,IsDesignTimeCreatable=False}"
ItemsSource="{Binding PagedCollection}"
AutoGenerateColumns="True">
<ig:XamGrid.Columns>
<ig:TextColumn IsFixable="True" x:Name="Base Clas" Key="BaseClass" HeaderText="Base Class" />
<ig:TextColumn IsFixable="True" x:Name="Derived Clas" Key="DerivedClass" HeaderText="Derived Class" />
</ig:XamGrid.Columns>
<ig:XamGrid.PagerSettings>
<ig:PagerSettings AllowPaging="Bottom" />
</ig:XamGrid.PagerSettings>
</ig:XamGrid>

I get runtime error saying that the Column called DerivedClass (which is present in DerivedClass1) is not found. What is a way around it?

Thanks!

Parents Reply Children
No Data