.NET DataGridView rows' default alignment all set to left

Posted by Xster on Stack Overflow See other posts from Stack Overflow or by Xster
Published on 2010-03-22T12:16:36Z Indexed on 2010/03/22 12:21 UTC
Read the original article Hit count: 327

Filed under:
|
|

DataGridView gets bound to DataTable. I then try to set some columns' DefaultCellStyle.Alignment to right. It doesn't work. After a bunch of tinkering, it turns out that every single row's DefaultCellStyle.Alignment is set to left and overrides it. DataGridView.DefaultCellStyle or RowsDefaultCellStyle doesn't do anything. Makes sense since a particular row's DefaultCellStyle is more specific but what gives. Why are they all set to something and not NotSet? How do I get rid of it instead of iterating through all rows?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about datagridview