当前位置:网站首页>Managing multiple selections with MVVM - managing multiple selections with MVVM
Managing multiple selections with MVVM - managing multiple selections with MVVM
2022-07-03 17:31:00 【Zafo】
problem :
On my journey to learning MVVM I've established some basic understanding of WPF and the ViewModel pattern. In my learning MVVM In the process of , I have established a right WPF and ViewModel Some basic understanding of patterns .I'm using the following abstraction when providing a list and am interested in a single selected item. I use the following abstraction when providing lists , And interested in a single selected project .
public ObservableCollection<OrderViewModel> Orders { get; private set; }public ICollectionView OrdersView{ get { if( _ordersView == null ) _ordersView = CollectionViewSource.GetDefaultView( Orders ); return _ordersView; }}private ICollectionView _ordersView;public OrderViewModel CurrentOrder { get { return OrdersView.CurrentItem as OrderViewModel; } set { OrdersView.MoveCurrentTo( value ); } }I can then bind the OrdersView along with supporting sorting and filtering to a list in WPF: then , I can put OrdersView With support for sorting and filtering bound to WPF List in :
<ListView ItemsSource="{Binding Path=OrdersView}" IsSynchronizedWithCurrentItem="True">This works really well for single selection views. This is very effective for radio views .But I'd like to also support multiple selections in the view and have the model bind to the list of selected items. But I also want to support multiple choices in the view , And bind the model to the selected list .
How would I bind the ListView.SelectedItems to a backer property on the ViewModel? How to integrate ListView.SelectedItems Bound to the ViewModel Upper backer attribute ?
Solution :
Reference resources : https://stackoom.com/en/question/3Mx6边栏推荐
- [combinatorics] recursive equation (special solution example 1 Hannover tower complete solution process | special solution example 2 special solution processing when the characteristic root is 1)
- [RT thread] NXP rt10xx device driver framework -- Audio construction and use
- vs code 插件 koroFileHeader
- Golang单元测试、Mock测试以及基准测试
- Electronic Science and technology 20th autumn "Microcomputer Principle and application" online assignment 2 [standard answer]
- QT学习日记9——对话框
- Notes on problems -- watching videos on edge will make the screen green
- Detailed explanation of common network attacks
- How to read the source code [debug and observe the source code]
- Financial management (Higher Vocational College) financial management online Assignment 1 in autumn 20
猜你喜欢

How to train mask r-cnn model with your own data

POM in idea XML graying solution

Test your trained model

【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用

人生还在迷茫?也许这些订阅号里有你需要的答案!

Applet setting multi account debugging

Leetcode Valentine's Day Special - looking for a single dog

How to purchase Google colab members in China

【RT-Thread】nxp rt10xx 设备驱动框架之--Audio搭建和使用

Automata and automatic line of non-standard design
随机推荐
QT learning diary 9 - dialog box
Golang unit test, mock test and benchmark test
鸿蒙第三次培训
数仓任务里面 跑SQL任务的时候用的数据库账号是在哪里配置的
Simple use of unity pen XR grab
Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
Svn full backup svnadmin hotcopy
How SVN views modified file records
Squid service startup script
人生还在迷茫?也许这些订阅号里有你需要的答案!
Dagong 21 autumn "power plant electrical part" online operation 1 [standard answer] power plant electrical part
Solution to long waiting time of SSH connection to remote host
绝对定位时元素水平垂直居中
Detailed explanation of common network attacks
Kotlin学习快速入门(7)——扩展的妙用
SVN完全备份svnadmin hotcopy
Apache服务挂起Asynchronous AcceptEx failed.
Where is the monitoring page of RDS database?
Free data | new library online | cnopendata complete data of China's insurance intermediary outlets
[UE4] brush Arctic pack high quality Arctic terrain pack