开发者

Updating the icons in an ObjectListView

开发者 https://www.devze.com 2023-01-02 14:47 出处:网络
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 ite

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 r开发者_JS百科eadonly 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?


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消