Multiple Selection in WPF with MVVM architect
hello everyone, good morning, good afternoon, good evening.
I am implementing a ListView in WPF like this. Can you tell me the best way to implement Multiple Selection? I am using the MVVM architect for my application.
8 Replies
The items in the list should have an IsSelected binding
Instead of a selected item at the top level of the VM
it seem like you talk about the checkbox, but my concern is about SelectedItems in ListView.
As you know, by default, ListView does not allow binding to the SelectedItems property, which is only available in the code-behind, making it confusing.
I implemented a behavior that works well. If you have another approach, please share how you did it. Here is my code
now, I can get the current selected items on ListView from user
in general if you're going to paste code
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/but I'm glad you got it working 🙂
ListView itself has a SelectionMode which you can set to multiple