[英]What object collection should I have to add objects?
I'm using Prism in WPF. 我在WPF中使用Prism。
I was watching the Prism starter kit, and it has a ICollectionView. 我当时在看Prism入门工具包,它具有ICollectionView。 In that collection, I need to add the object selected in it.
在该集合中,我需要添加在其中选择的对象。 What object (or collection) should I use to add objects?
我应该使用什么对象(或集合)来添加对象?
I mean in the image, I have two listbox, in the first one I've got a readonly collection and the second one is a list where can add or remove objects. 我的意思是在图像中,我有两个列表框,第一个是只读集合,第二个是可以添加或删除对象的列表。
Your List should be bound to an ICollectionView that wraps an ObservableCollection. 您的列表应绑定到包装ObservableCollection的ICollectionView。 When you add, you add to this Observable collection.
添加时,您将添加到此Observable集合。
Ie 即
private readonly ObservableCollection<Stock> listToAddTo;
public ICollectionView List2 { get; private set; }
Constructor 建设者
listToAddTo = new ObservableCollection<Stock>();
List2 = CollectionViewSource.GetDefaultView(listToAddTo);
Where List2 is what is bound to List2绑定到哪里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.