Contents of the Datagrid cell need to centered. Set the textalignment property. But the contents are not centered. Am i missing something.
Style aStyle = new Style()
{
TargetType = typeof(TextBlock)
};
aStyle.Setters.Add(new Setter(TextBlock.TextAlignmentProperty,TextAlignment.Center));
DataGridTextColumn c1 = new DataGridTextColumn();
c1.Width = 20;
c1.Header = "Index";
c1.Binding = new Binding("Index");
c1.Width = 110;
c1.IsReadOnly = true;
c1.ElementStyle = aStyle;
aDataGrid.Columns.Add(c1);