Bohn
Bohn

Reputation: 26919

Multiple Selecting Item in ListView

Using the code from this page to start with:
http://www.java2s.com/Code/CSharp/GUI-Windows-Form/DragginganddroppingbetweenListView.htm

I am trying to find out what needs to be added to support two more features:
a) Be able to multi-select and move items all together.
b) Be able to do the moving on a single item when we double click on it.

Any more information, reading material, to help with two questions above that can put me on the right track are much appreciated.

Thanks.

Upvotes: 0

Views: 2118

Answers (1)

Yatrix
Yatrix

Reputation: 13775

Set the MultiSelect = True in the designer. This allows you to select > 1 items.

I'm not sure what you mean "Be able to do the moving on a single item when we double click on it". It sounds like you want to move an item from one ListView to another when you double-click it. In that case, create a copy of the ListViewItem you double-clicked in the double-click event (I think it's e.Item, maybe?) and then add it or insert it into the other list in the code-behind. If you want to delete it from the list you double-clicked on, just use MyListView.RemoveAt and pass the index of that item.

This isn't too bad to write, code-wise, so I won't write out all the steps. But that's what you'll want to do, step-wise.

Upvotes: 2

Related Questions