title: Populate Datagrid in WPF User Control
body: <p>I'm crazy with a very simple Datagrid population via DataContext property (binding a DataTable) in a WPF User Control. I trasnport the code from User Control Project to a WPF Windows Project and it works fine. What happens? Bellow the code that works in WPF Window and dont works in WPF User Control:</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;DataGrid AutoGenerateColumns="true" ItemsSource="{Binding}" Height="282" HorizontalAlignment="Left" Margin="6,6,0,0" Name="datGrdFalhas" VerticalAlignment="Top" Width="494" FontWeight="Normal" IsReadOnly="True" FontSize="14" TabIndex="211" /&gt;
  </code></pre>
  
  <p>Code:
  ...</p>
  
  <pre><code>        DataTable datTblFalhas = new DataTable();
          datTblFalhas.Columns.Add("Alarme",
                                   typeof(string)
                                  );
          datTblFalhas.Columns.Add("Momento",
                                   typeof(string)
                                  );
  
          DataRow datRowAlarme = datTblFalhas.NewRow();
          datRowAlarme[0] = "a";
          datRowAlarme[1] = "b";
          datTblFalhas.Rows.Add(datRowAlarme);
  
          datGrdFalhas.DataContext = datTblFalhas;
  </code></pre>
  
  <p>...</p>
  
  <p>Thanks,</p>