WPF How to binding two tables into one datagrid on xaml page

Aug 23, 2009 at 3:00 PM

Please help.

I have two relational tables which are Employee and EmployeePosition. I am trying to bind two tables into one datagrid on the xmal file **without using LINQ** to join those two table into one collection from the c# code behind. HOW CAN I DO IT?
The sample code and table below

**Empolyee**
EmployeeID
FirstName
LastName
PositionID

**EmployeePosition**
PositionID
Title

My excepted result is:

    EmployeeID   FirstName   LastName  Title

 

**Xaml file**

<dg:DataGrid x:Name="DataGrid"
                     AutoGenerateColumns="False">
           
            <toolkit:DataGridTextColumn Header="First Name" Width="Auto" 
                                           Binding="{Binding FirstName}"/>

            <toolkit:DataGridTextColumn Header="Last Name" Width="Auto" 
                                           Binding="{Binding LastName}"/>
           
            <toolkit:DataGridTextColumn Header="Title" Width="Auto" 
                                           Binding="{Binding Title}"/>
</dg:DataGrid>


**The C# Code**

var employee = from e in _db.Employees
                           Select e;
            this.DataGrid.ItemsSource = employee;

 


Please help
Patrick