Increase Space Between Columns in ListView

Created: 14 August 2013

In most standard views columns are shown near each other without any space between them. IntegralUI ListView allows you to easily increase space between columns. This can be useful in cases where we need to create a separation between different data in columns.

Space Between Columns

To increase space between columns we will use ColumnSpacing property which can accept any value from 0 to 255. For example if we set this value to 10, the distance between columns in ListView will be exactly 10 pixels.

How to Fill the Remaining Space

Although we can change the space between columns and adjust their width, usually there will remain some space unpopulated by columns at the right end of ListView layout. To fill this space we need to calculate how much the content width of ListView is, and subtract that value from total width of all columns plus the space between them. We also need to make sure that we take into our calculations only visible columns. The result will be something like this:

A sample project in C# and VB showing how to change distance between columns is available for download from here: Change Space Between Columns

Tab content switching

Newsletter

Sign-up to our newsletter and you will receive news on upcoming events, latest articles, samples and special offers.

Name:

Email: *

*By checking this box, I agree to receive a newsletter from Lidor Systems in accordance with the Privacy Policy. I understand that I can unsubscribe from these communications at any time by clicking on the unsubscribe link in all emails.