View previous topic :: View next topic |
Author |
Message |
JohnSummit
Joined: 10 Apr 2008 Posts: 32
|
Posted: Tue Jul 14, 2009 7:50 am Post subject: How to programmaticallyretrieved the icon set to a tree node |
|
|
I have a need to programmatically retrieve the icon previously set for a row via the 'virtualTree1_GetRowData' event handler. The only thing i have access to is the Row.Item reference (i.e. a referent to the tree node itself).
Is there not a way to get from the Item to the rowdata? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Jul 14, 2009 11:20 pm Post subject: |
|
|
Virtual Tree only keeps the RowData for the Rows that are currently displayed. So probably the simplest thing to do is to call the binding yourself to get RowData eg
Code: | RowBinding binding = _virtualTree.GetRowBinding(e.Row);
RowData rowData = new RowData(_virtualTree);
binding.GetRowData(e.Row, rowData) |
Virtual Tree does keep a cache of the RowData for the currently displayed rows (just those actually visible). The GetDataForRow method checks this before return the RowData - however this method is protected so you have to derive a new class and provide a public method to call this if you wanted to make use of it. Unless you are calling this method at a very high frequency the first suggested method would suffice. _________________ Infralution Support |
|
Back to top |
|
|
JohnSummit
Joined: 10 Apr 2008 Posts: 32
|
Posted: Wed Jul 15, 2009 5:10 am Post subject: |
|
|
Thanks. I ended up caching the icon in my item object directly. |
|
Back to top |
|
|
|