I'm using EF4 and have a entity in my domain model called Applications. Applications has a navigation property called Status. The Status Entity contains 2 fields, StatusID and StatusName. I'm displaying a DataGrid that shows the details of Applications. I have decorated the Application Metadata with the [Include] attribute, and have also modified the GetApplicationsQuery to have an .Include("status") statement. The ItemsSource for the grid is set in code using a Linq query.
If I set AutoGenerateColumns on my DataGrid to true, the status column indicates that there is a status object, so it looks like the Includes are working correctly. I now want to set AutoGenerateColumns to false and manually build the datagrid (to only show a few columns), but I can't find how to bind the StatusName field (belonging to the status navigation property) to one of the columns. The code below obviously doesn't work as i'm effectively binding the Status column to an object, but what is the correct way to bind to a field on a navigation property?
<telerik:GridViewDataColumn Header="App Name" DataMemberBinding="{Binding AppName}"/>
<telerik:GridViewDataColumn Header="Commentary" DataMemberBinding="{Binding Commentary}"/>
<telerik:GridViewDataColumn Header="Status" DataMemberBinding="{Binding **status**}"/>
I've tried binding to status.StatusName, but i'm just guessing now. Any help would be appreciated.
Thanks
M