Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text Align column in Listview: first column cannot be centered

I have a Listview in detail mode with 3 columns. I want to set the text align for the headers to "center". This works for the last two columns but not for the first. If I want to change it to "center" and click on "center", the field keeps being set to "left". Can I change this using the properties or do I need to program this?

Thanks.

like image 796
benst Avatar asked Aug 28 '12 09:08

benst


1 Answers

According to the documentation:

Due to a limitation in the underlying control, this property has no effect on the first column in the ListView control, which is always aligned to the left. To work around this limitation in .NET Framework version 2.0, you can handle the ListView.DrawColumnHeader event and paint the column header yourself.

Another alternative workaround is to not use the first column at all and hide it by setting its width to zero.

like image 193
Antagony Avatar answered Oct 02 '22 14:10

Antagony