Reputation: 256701
How can i get the ListViewItem
of a ListView
that is in virtual mode?
i would call:
//Get ListViewItem corresponding to index 37
var e = new RetrieveVirtualItemEventArgs(37);
listView.RetrieveVirtualItem(sender, e);
return e.Item;
except that Andreas Helberg decided i should not be allowed to do that.
How can i get the ListViewItem
, corresponding to an index, of a virtual mode ListView?
Upvotes: 0
Views: 623
Reputation: 5097
You may have to create a class and inherit from whatever class you're using which inherits from ListView
(I'm assuming this because if you were using the ListView
class directly, then you would probably have access to the underlying cache and the mechanisms to get the item at a particular index would be manifest), create a public wrapper function, call the protected OnRetrieveVirtualItem
function with the parameter you specified in your example code and the return the .Item
from there, so
RetrieveVirtualItemEventArgs args = new RetrieveVirtualItemEventArgs(37);
this.OnRetrieveVirtualItem(args);
return args.Item;
Upvotes: 1