Alignment of columns in datagrid

  • Thread starter Thread starter Tim Conner
  • Start date Start date
T

Tim Conner

It seems that all fields in a standard DataGrid default to align to the left,
including numbers.

I can't find the "columns" property of the grid, to change the behavior of the
particular columns.

Where do I change that ?


Regards,
 
DataGrid->TableStyle(s)->GridColumnStyle(s). DataGridColumnStyle defines
column showed in DataGrid and has a property "Alignment".
 
hi,

maybe i´m wrong, but i think u have to create a DataGridTableStyle for that.
try something like this:

DataGridTableStyle tableStyle = new DataGridTableStyle();

tableStyle.MappingName = TableName;

DataGridTextBoxColumn aColumnTextColumn = new
DataGridTextBoxColumn_NoActiveCell();

aColumnTextColumn.Alignment = HorizontalAlignment.Center;

tableStyle.GridColumnStyles.Add(aColumnTextColumn);



this.TableStyles.Clear();

this.TableStyles.Add(tableStyle);


hope this helps.

peace René
 
Back
Top