title: wpf datagrid databind with nested objects (like master detail)
body: <p>I have a simple problem binding an entity to datagrid in wpf.</p>
  
  <p>I have an entity Called "User".... and each "User" have one "Workgroup" .. the relationship between the two is one to one.</p>
  
  <p>now in EF every User entity has one workgroup entity inside.</p>
  
  <p>when I want to bind Users Collection to datagrid I have no clue hot to say that you have to put forexample workgroup.Title inside a datagrid Column</p>
  
  <p>I'm trying to bind in this way :</p>
  
  <p><b>
  XAML:</p>
  
  <pre><code>&lt;DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Users}" HorizontalAlignment="Stretch" Margin="5" Name="dgUserList" VerticalAlignment="Stretch" SelectionChanged="dgUserList_SelectionChanged"&gt;
                  &lt;DataGrid.Columns&gt;
                      &lt;DataGridTextColumn Binding="{Binding FirstName}" Header="FirstName" /&gt;
                      &lt;DataGridTextColumn Binding="{Binding LastName}" Header="LastName" /&gt;
                      &lt;DataGridTextColumn Binding="{Binding Username}" Header="UserName" /&gt;
                      &lt;DataGridTextColumn Binding="{Binding WorkGroup}" Header="Workgroup" /&gt;
                  &lt;/DataGrid.Columns&gt;
              &lt;/DataGrid&gt;
  </code></pre>
  
  <p>Code Behind :
  Created a property like this :</p>
  
  <pre><code>public List&lt;User&gt; Users
      {
          get { return dal.GetUsers(); }
      }
  </code></pre>
  
  <p>and do the binding :</p>
  
  <pre><code>private void BindGrid()
      {
          dgUserList.ItemsSource = Users;
      }
  </code></pre>
  
  <p></b></p>
  
  <p>this work file with direct properties of User Entity but it puts type of Workgroup entity inside the datagrid column and the reason is obvious. I want to put the Title of workgroup inside</p>
  
  <p>how can i achive this ?</p>
  
  <p>any help would be greatly appreciated</p>