Owl's Blog on .NET development

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

Hiding Items in Better ListView

We currently introduced a BetterListViewItem.Visible property to allow hiding items visually, but keeping then in the Items collection:

Making items invisible

Making items invisible

The above image shows two groups of items. The first groups uses hiding of items with the Visible property, while the second group simply turns off drawing of ceratin items.

The first approach is useful when you need to hide item as if it is removed, but keep it actually within Items collection.

The second approach need to create new control inheriting from BetterListView, overrride the OnDrawItem method and set properties like BetterListViewDrawItemEventArgs.DrawImage to false or simply not call the base implementation of OnDrawItem.

The second (owner drawing) approach is useful when you need just to switch off display of item without changing the item layout.

Leave a Reply