I have two tables in a database and using entity framework and ria services to display data in a simple datagrid. Here is the database/EF structure
Cars Make
----- ----
CarId MakeId
Car Make
MakeId
In my Silverlight datagrid I want to show the following two columns, for example
Car Make
--- -----
Escort Ford
Megane Renault
Rav4 Toyota
I can easily bind to the Cars table and show cars but I can't work out how to display the Make taken from the child table
The xaml that I am using to configure the datagrid is as follows:
<datagrid:DataGrid x:Name="CarGrid" AutoGenerateColumns="False" MinHeight="100" IsReadOnly="True" ItemsSource="{Binding ElementName=MyData, Path=Data}">
<datagrid:DataGrid.Columns>
<datagrid:DataGridTextColumn Header="Car" Binding="{Binding Car}"/>
<datagrid:DataGridTextColumn Header="Make" Binding="{Binding Cars.Make}"/>
......
The datagrid datasource binds to a DomainDataSource method "GetCars". I'm not sure if it is automatically loading the child table (not sure whether I have to explicitly tell it to or not, and have no idea how to do this in xaml).
I'm sure I could ditch the xaml and do it in c# but I'm trying to be a good coder and do it in xaml.