Selected Items using MVVM in WinRT

别说谁变了你拦得住时间么 提交于 2019-12-18 20:48:07

问题


I'm struggling to find a way to bind the SelectedItems property in a ListView to the view model.

Previously I used this: http://www.codeproject.com/Articles/412417/Managing-Multiple-selection-in-View-Model-NET-Metr which no longer works in the RTM release.

Any help is much appreciated!

Thanks in advance :)


回答1:


You could look at the ListViewExtensions.BindableSelection from the WinRT XAML Toolkit on CodePlex.




回答2:


Turns out binding to the attached property was failing because the type of the attached property was being seen as

From the output window in Visual Studio:

type ('null')

After further research it became apparent that any generic class would fail to bind with this exact error. As a quick fix I simply changed the type to "object".




回答3:


You can direct bind the selected item to another ui element or a property in your mvvm class



来源:https://stackoverflow.com/questions/12495116/selected-items-using-mvvm-in-winrt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!