//
you're reading...
.NET 2.0, Technology

Getting along with ListView’s VirtualList mode (Part 2)

In my last post I detailed how I go about removing items from my backingList after a drag ‘n drop operation has been performed, but I didn’t mention how I went about sending that information through the drag and drop.

I think it was rather ingenious, but that could be because I’ve been awake for too long…since I control both the source and destination for the drag/drop I’m able to send the data in any method I choose. In my case I chose to send that data by just passing in the same SelectedIndexCollection used to remove those items.

This alleviates one major problem: If 20,000 items are selected I’m not creating yet another array of 20,000 items only to be used temporarily. In my testing I found trying to do a drag/drop with 20,000 items selected the app basically froze trying to copy item indices around…then I switched to using the SelectedIndexCollection and all was well.

One major caveat though: If you intend on doing updating your backing store from another thread and allow UI interaction you run the chance of the items in the SelectedIndexCollection changing while you are working with them. Calling BeginUpdate and EndUpdate on the ListView should stop that from happening, but all the same; be very careful with it.

Advertisements

About James

I am a Senior Developer/Consultant for InfoPlanIT, LLC. I previously spent over 7 years as a Product Manager for what eventually became ComponentOne, a division of GrapeCity. While there, I helped to create ActiveReports 7, GrapeCity ActiveAnalysis, and Data Dynamics Reports.

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archive

%d bloggers like this: