C
C#•2mo ago
obason

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.
No description
8 Replies
lycian
lycian•2mo ago
The items in the list should have an IsSelected binding Instead of a selected item at the top level of the VM
obason
obasonOP•2mo ago
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
obason
obasonOP•2mo ago
No description
obason
obasonOP•2mo ago
No description
obason
obasonOP•2mo ago
now, I can get the current selected items on ListView from user
lycian
lycian•5w ago
in general if you're going to paste code $code
MODiX
MODiX•5w ago
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/
lycian
lycian•5w ago
but I'm glad you got it working 🙂 ListView itself has a SelectionMode which you can set to multiple
Want results from more Discord servers?
Add your server