title: C# wpf Datagrid content alignment center via code
body: <p>I generate a Datagrid and want to center the content.</p>
  
  <p>this is my code:</p>
  
  <pre><code>DataGrid tabelle = new DataGrid();
  tabelle.ItemsSource = dt.DefaultView;
  tabelle.RowHeight = 50;
  tabelle.VerticalContentAlignment = VerticalAlignment.Center;
  tabelle.HorizontalContentAlignment = HorizontalAlignment.Center;
  </code></pre>
  
  <p>It doesnt work... but why?</p>