当前位置:网站首页>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边栏推荐
- 简单配置PostFix服务器
- Tensorboard quick start (pytoch uses tensorboard)
- Kotlin learning quick start (7) -- wonderful use of expansion
- 远程办公工具分享|社区征文
- AcWing 4489. Longest subsequence
- Free data | new library online | cnopendata complete data of China's insurance intermediary outlets
- UE4 official charging resources, with a total price of several thousand
- One brush 146 force buckle hot question-3 longest substring without repeated characters (m)
- 数仓任务里面 跑SQL任务的时候用的数据库账号是在哪里配置的
- [combinatorics] recursive equation (general solution structure of recursive equation with multiple roots | linear independent solution | general solution with multiple roots | solution example of recu
猜你喜欢

How do large consumer enterprises make digital transformation?

TensorBoard快速入门(Pytorch使用TensorBoard)

新库上线 | CnOpenData中国保险机构网点全集数据

Wechat applet for the first time
![[RT thread] NXP rt10xx device driver framework -- pin construction and use](/img/75/b4f034bfe49409f76e7fd92758804e.png)
[RT thread] NXP rt10xx device driver framework -- pin construction and use

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

Leetcode 669 pruning binary search tree -- recursive method and iterative method

【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用
![[error reporting] omp: error 15: initializing libiomp5md dll, but found libiomp5md. dll already initialized.](/img/a0/4fc0e0741aad2885873e60f2af3387.jpg)
[error reporting] omp: error 15: initializing libiomp5md dll, but found libiomp5md. dll already initialized.

Golang unit test, mock test and benchmark test
随机推荐
企业级自定义表单引擎解决方案(十一)--表单规则引擎1
Test your trained model
毕业总结
SWM32系列教程4-端口映射及串口应用
Internet hospital his management platform source code, online consultation, appointment registration smart hospital applet source code
One brush 147-force deduction hot question-4 find the median of two positive arrays (H)
First day of rhcsa study
Simple use of unity pen XR grab
设计电商秒杀
Vs2013 has blocked the installer, and ie10 needs to be installed
Apache service suspended asynchronous acceptex failed
One brush 149 force deduction hot question-10 regular expression matching (H)
RedHat 6.2 配置 Zabbix
QT learning diary 9 - dialog box
Enterprise custom form engine solution (XI) -- form rule engine 1
[combinatorics] recursive equation (special solution form | special solution solving method | special solution example)
[combinatorics] recursive equation (solution of linear non-homogeneous recursive equation with constant coefficients | standard form and general solution of recursive equation | proof of general solut
Brief introduction to the core functions of automatic penetration testing tool
新库上线 | CnOpenData中国保险机构网点全集数据
What is the difference between cloud server and cloud virtual machine