WPF-ObservableCollection 的多个视图
我有一个包含两个定义的 CollectionView 的视图模型。
我用它来导航和数据输入/编辑。 另一个我想用于过滤目的并在表单上的某些列表视图中显示过滤。
当我对 observablecollection 应用过滤时,我不希望主视图(用于 DataEntry 目的)受到影响。
提前致谢!
I have a viewmodel containing two CollectionViews defined.
One I am using for navigation and data entry/edit.
Another I want to use for filtering purpose and show the filteration in some Listview on the form.
I don't want the main view(used for DataEntry purpose) to get affected while I applying filteration on observablecollection.
Thanks in Advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只要您使用单独的集合视图,更改一个集合视图就不会影响另一个集合视图。这就是集合视图的要点 - 它们是同一集合的独立视图。
As long as you're using separate collection views, changing one won't affect the other. That is the point of collection views - they're independent views on the same collection.
好的,明白了!并以同样的想法继续前进。但是当我这样做时,我得到错误=“调用线程无法访问该对象,因为另一个线程拥有它。”。因此我的过滤不起作用..以下是代码-
ok, Got it! and went ahead with the same idea. But when I did so, I get Error = "The calling thread cannot access this object because a different thread owns it.". Hence my filteration doesn't work.. Following is the code-