views:

43

answers:

1

I'm using an TreeListView (a sub type of ObjectListView) in my current project. Each item in the list is given an icon, but the icon my vary depending on the state of the item. For example if the item is readonly I want to use an icon with a little lock symbol.

When the items are first added to the TreeListView the icons are show correctly, yet later when the state of an item changes the icons are not updating. How do I force the control to regenerate all the icons?

A: 

Since the icon is gotten when the ImageGetter for the first column is called, and since that is only called typically when the rows regenerate, then it seems like you could simply call BuildList and force all rows to rebuild. This might be expensive, though, depending on the complexity and number of rows.

A better solution, if possible, would be to call RefreshItem or RefreshObject as soon as you know data has changed. This requires you to know either the specific OLVListItem (rows) that need their icons updated, or the underlying model objects that changed (and thus would cause the icon to differ were its associated rows rebuilt).

Yadyn