Please Help Me! RetreiveVirtualItem & ImageList

G

Guest

private void RetreiveVirtualItem( object sender, RetrieveVirtualItemEventArgs
e )
{
e.Item = new ListViewItem( e.ItemIndex.ToString() );
}

Take this for example; works fine.

Now if I want to associate a image with the item I would use a different
constructor and pass a string image key.

My problem is, how do I assign a value to e.ImageList. It is read only and
it seems that the ListView object itself doesnt assign it's own ImageList to
the e.Item

So how do I use Virtual lists and assign a ImageList to a ListViewItem?
 
G

Guest

Hawk,
set the imagelist at design time and at run time add items to the imagelist.
Good Luck
DWS
 
G

Guest

Yes, this worked thank. Though I find it weird that this cant be assigned at
runtime. I am curious to MS decision at implementing it this way.

One other quirk I noticed is the when the object is created it doesnt seem
to generate the virtual caching event first.

Oh well all is well now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top