当前位置:网站首页>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边栏推荐
- Leetcode Valentine's Day Special - looking for a single dog
- TensorBoard快速入门(Pytorch使用TensorBoard)
- Apache服务挂起Asynchronous AcceptEx failed.
- 1164 Good in C
- First day of rhcsa study
- Electronic Science and technology 20th autumn "Microcomputer Principle and application" online assignment 2 [standard answer]
- Squid service startup script
- Luogu: p2685 [tjoi2012] Bridge
- vs code 插件 koroFileHeader
- Web-ui automated testing - the most complete element positioning method
猜你喜欢

Internet hospital his management platform source code, online consultation, appointment registration smart hospital applet source code

1164 Good in C

Vs2013 has blocked the installer, and ie10 needs to be installed

1146_ SiCp learning notes_ exponentiation
![[RT thread] construction and use of --hwtimer of NXP rt10xx device driver framework](/img/df/a7719bcb00ff66e21f3a391ab94573.png)
[RT thread] construction and use of --hwtimer of NXP rt10xx device driver framework

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

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

QT learning diary 9 - dialog box
![[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.

鸿蒙第四次培训
随机推荐
New library online | cnopendata China bird watching record data
Assignment examination questions of advanced English (III) for the course examination of Fujian Normal University in February 2022
【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用
[combinatorics] recursive equation (special solution form | special solution solving method | special solution example)
How to enforce parameters in PowerShell- How do I make parameters mandatory in PowerShell?
[combinatorics] recursive equation (definition of general solution | structure theorem of general solution of recursive equation without multiple roots)
Graduation summary
[combinatorics] recursive equation (case where the non-homogeneous part is exponential | example where the non-homogeneous part is exponential)
[UE4] brush Arctic pack high quality Arctic terrain pack
[combinatorics] recursive equation (example of solving recursive equation without multiple roots | complete process of solving recursive equation without multiple roots)
i++与++i的区别:通俗易懂的讲述他们的区别
c# .net 工具生态
VM11289 WAService. js:2 Do not have __ e handler in component:
First day of rhcsa study
QT学习日记9——对话框
Online assignment 3 of mobile Internet technology in the 20th autumn of electronic technology [standard answer]
Examination questions for the assignment of selected readings of British and American Literature in the course examination of Fujian Normal University in February 2022
Rsync remote synchronization
STM32H7 HAL库SPI DMA发送一直处于busy的解决办法
One brush 146 force buckle hot question-3 longest substring without repeated characters (m)