1
我有一個列表框和一個樣本的ObservableCollection,當我設置listBox1.ItemsSource = _collection;在代碼隱藏文件中,它工作正常,但是當我在XAML中這樣做時:綁定列表框到一個ObservableCollection在XAML
ItemsSource="{Binding Collection}"
它不起作用。可能是什麼問題?
在代碼隱藏我
public ObservableCollection<FeedItem> Collection
{
get { return _collection; }
}
是的,你說得對。當我做'this.DataContext = _collection'和.xaml'ItemSource = {綁定}'所有工作fine.Thx – 2013-03-03 20:16:18