When using ListView multiselect how do I manage all selected items? #1518
Answered
by
tznind
Ben2146053
asked this question in
Q&A
|
How do I manage the process of getting all selections from a multiselect with ListView? |
Answered by
tznind
Nov 19, 2021
Replies: 1 comment
|
To be clear when you talk about 'getting all selections' you are meaning these right? If you have a list of objects that you provided as the So for example if you have a myList.Where((e, idx) => lv.Source.IsMarked(idx)) If you don't have a copy of your original list (i.e. lv.Source.ToList().Cast<object>().ToList().Where ((e,idx)=>lv.Source.IsMarked(idx)) |
0 replies
Answer selected by
Ben2146053
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

To be clear when you talk about 'getting all selections' you are meaning these right?
Tick indicates marked items
If you have a list of objects that you provided as the
Sourcefor the ListView then you can get those that have been multi selected (ticked) by using thebool IsMarked(int)method of the source. It takes the index of the list and returns true/false for whether it is ticked.So for example if you have a
ListViewcalledlvand aList(of data objects) calledmyListyou could use the following Linq:If you don't have a copy of your original list (i.e.
myList) you could still get the list of objects with something like (you could…