在WinRT中使用MVVM选择的项目 [英] Selected Items using MVVM in WinRT
问题描述
我正在努力寻找一种方法,以将ListView中的SelectedItems属性绑定到视图模型.
I'm struggling to find a way to bind the SelectedItems property in a ListView to the view model.
以前,我是这样使用的: http://www. codeproject.com/Articles/412417/Managing-Multiple-selection-in-View-Model-NET-Metr (在RTM版本中不再起作用).
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.
非常感谢您的帮助!
先谢谢您了:)
推荐答案
结果是,由于将附加属性的类型视为
Turns out binding to the attached property was failing because the type of the attached property was being seen as
在Visual Studio的输出窗口中:
类型("null")
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".
这篇关于在WinRT中使用MVVM选择的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!