Sorry if this has been asked before, but I can't seem to find an answer to this question.
I'm currently using Silverlight to populate a xamGrid using WCF RIA Services and the Entity Framework.
The data I'm binding to is not flat in structure, i.e. I have a collection of entities that include other related entities.
My problem is when I bind the itemsSource for the xamGrid, the standard text columns seem to expect a flat data source
(i.e. I can only specify a "Key" property that points to a property that is directly on my ItemsSource entities).
I cannot seem to bind to a subproperty.
Ex: I have a "Car" Entity that contains several "Wheel" Entities.
How do I display properties from the Car and Wheel entities in a single row in the grid ?
With the regular silverlight datagrid, I can specify the column binding as :
<sdk:DataGridTextColumn Header="Car Make"
Binding="{Binding Path=Car.Make}" />
<sdk:DataGridTextColumn Header="Wheel Size"
Binding="{Binding Path=Wheel.Size}" />
I guess my question is "is there a way to specify a binding path to a sub-property using the xamGrid ?"
-Nadim
Hello Nadim,
Thank you for your post. I have been looking into it and I can suggest you use UnboundColumns. You can set their ItemTemplate and bound them to the subitem’s Properties. I created a sample project for you showing how to do so. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
That worked, thanks !
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.