# Owl's Blog on .NET development

Component Owl codes Better ListView control all night so you don't have to.

## How to Hide a Column in Better ListView

Blog Post by Libor Tinka published on Friday, 05 August 2011 in Better ListView, Tutorials

The most popular view in ListView-like controls seems to be the “Details” view with columns, items and sub-items.

When someone wants to remove a column, he usually thinks of simply removing the column header from the Columns collection. Unfortunately, it’s not that simple. The sub-items get shifted and he needs to remove sub-items corresponding to the removed column for all items as well.

This is because ListView is not a control for displaying grids (a matrix of cells), but really the lists – sequences of objects, and the sub-items are not cells either, they are something like an extension of each item to support additional information about the item.

So how we neatly hide a column?

We introduced Column Hiding feature in the version 2.0.1. You can simply call Hide() on your column header instance and you’re done! There is also corresponding Show() method provided. Or you can set boolean Visible property. Now the column and all subsequent sub-items are hidden from view (although they are still present in data, of course):

Hiding column via context menu...

...and the sixth column gets hidden.

Download Better ListView

Tags: 2.01, column, columns, details, hide, hiding, visible

### Leave a Reply

Click here to cancel reply.

Name (required)

Mail (will not be published) (required)

Website