title: WPF C# Data-binding to DataGridTextColumn
body: <p>I'm having a difficult time getting any data in this datagrid view to appear. I've followed some suggestions in a few other StackOverflow forum posts but am not having any luck getting the content to appear. </p>
  
  <pre><code>&lt;DataGrid 
      x:Name="DataGridEmployees"
      DataContext="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
      ItemsSource="{Binding GridView}"
      AutoGenerateColumns="True"
      Loaded="dataGrid1_Loaded"
      Margin="0,2,0,-2" Grid.ColumnSpan="2"&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Header="EmployeeId" Width="175" Binding="{Binding Id}"&gt;&lt;/DataGridTextColumn&gt;
          &lt;DataGridTextColumn Header="Title" Width="175" Binding="{Binding Title}"&gt;&lt;/DataGridTextColumn&gt;
          &lt;DataGridTextColumn Header="WorkStatus" Width="175" Binding="{Binding WorkStatus}"&gt;&lt;/DataGridTextColumn&gt;
          &lt;DataGridTextColumn Header="FullName" Width="175" Binding="{Binding FullName}"&gt;&lt;/DataGridTextColumn&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>This is the click event that is being fired from a separate window (? could this be causing any problems?) in the xaml.cs file</p>
  
  <pre><code>public partial class MainMenu : Window
  {
      WpfSampleEntities2 _context = new WpfSampleEntities2();
  
      public MainMenu()
      {
          InitializeComponent();
      }
  
      private void Button_Click_1(object sender, RoutedEventArgs e)
      {
          EmployeeDetails ed = new EmployeeDetails();
          ed.DataContext = ed.DomainEmployees;
          Binding bin = new Binding("GridView");
          bin.Source = ed.DomainEmployees;
  
          foreach (var item in ed.DomainEmployees)
          {
              bin.Path.PathParameters.Add(item);
          }
  
          ed.Show();
      }
  
  }
  </code></pre>
  
  <p>And here is the <code>EmployeeDetails.cs</code> class/vm:</p>
  
  <pre><code>[TypeConverter(typeof(DataGridTextColumn))]
  public class MVVMEmployee : Employee
  {
      public int Id { get; set; }
      public string FullName { get; set; }
      public string Title { get; set; }
      public string WorkStatus { get; set; }
  
      public MVVMEmployee() { }
      public MVVMEmployee(int id, string fullName, string title, string workStatus)
      {
          this.Id = id;
          this.FullName = fullName;
          this.Title = title;
          this.WorkStatus = workStatus;
      }
  }
  </code></pre>
  
  <p>I've also tried with the <code>XAML</code> as:</p>
  
  <pre><code>&lt;DataGrid
      x:Name="DataGridEmployees"
      DataContext="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
      ItemsSource="{Binding GridView}"
      AutoGenerateColumns="True"
      Loaded="dataGrid1_Loaded"
      Margin="0,2,0,-2" Grid.ColumnSpan="2"&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Header="EmployeeId" Width="175" Binding="{Binding ElementName=Id}" &gt;&lt;/DataGridTextColumn&gt;
          &lt;DataGridTextColumn Header="Title" Width="175" Binding="{Binding ElementName=Title}"&gt;&lt;/DataGridTextColumn&gt;
          &lt;DataGridTextColumn Header="WorkStatus" Width="175" Binding="{Binding ElementName=WorkStatus}"&gt;&lt;/DataGridTextColumn&gt;
          &lt;DataGridTextColumn Header="FullName" Width="175" Binding="{Binding ElementName=FullName}"&gt;&lt;/DataGridTextColumn&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>