tags:

views:

365

answers:

1

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

        <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}"/>

The C# Code

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

Please help Patrick

A: 
free-dom
Thank you free-domBut i would like to binding the Title field on xmal file without join the table behind the code.Patrick
Unfortunately, the DataGrid can only have one DataSource object, so at some level there will have to be some object that joins the two together.If you don't want to create a new DataTable that brings the two together, then you can provide a proxy class that gets the data you are looking for instead, and bind to it instead.
free-dom