当前位置:网站首页>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
- How to read the source code [debug and observe the source code]
- Great changes! National housing prices fell below the 10000 yuan mark
- One brush 145 force deduction hot question-2 sum of two numbers (m)
- Vs2013 has blocked the installer, and ie10 needs to be installed
- Swm32 series Tutorial 4 port mapping and serial port application
- 网络硬盘NFS的安装与配置
- Hongmeng fourth training
- Analyse ArrayList 3: suppression d'éléments
- One brush 146 force buckle hot question-3 longest substring without repeated characters (m)
猜你喜欢

How to train mask r-cnn model with your own data
![[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

Automata and automatic line of non-standard design

国内如何购买Google Colab会员

PS screen printing brush 131, many illustrators have followed suit

vs2013已阻止安装程序,需安装IE10

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

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

Test your trained model

【RT-Thread】nxp rt10xx 设备驱动框架之--Audio搭建和使用
随机推荐
Unity notes unityxr simple to use
c# .net 工具生态
Type conversion, variable
Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
i++与++i的区别:通俗易懂的讲述他们的区别
互聯網醫院HIS管理平臺源碼,在線問診,預約掛號 智慧醫院小程序源碼
kubernetes资源对象介绍及常用命令(三)
[set theory] order relation: summary (partial order relation | partial order set | comparable | strictly less than | covering | hasto | total order relation | quasi order relation | partial order rela
QT learning diary 9 - dialog box
大变局!全国房价,跌破万元大关
Svn full backup svnadmin hotcopy
Simple configuration of postfix server
Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
Web-ui automated testing - the most complete element positioning method
[combinatorics] recursive equation (four cases where the non-homogeneous part of a linear non-homogeneous recursive equation with constant coefficients is the general solution of the combination of po
新库上线 | CnOpenData中国保险机构网点全集数据
Play with fancy special effects. This AE super kit is for you
A day's work list of an ordinary programmer
绝对定位时元素水平垂直居中
Host based intrusion system IDS