我有一個wpf用戶控件,它公開IEnumerable ItemsSource DependencyProperty。我將此屬性綁定到我的UserControl中的ListBox控件。如何使我的WPF UserControl與CompositeCollection一起工作
我想知道如何在給出CompositeCollection時讓我的用戶控件工作。目前我使用我的控制是這樣的:
<my:uc>
<my:uc.ItemsSource>
<CompositeCollection>
<CollectionContainer Collection="{My Binding}"></CollectionContainer>
<CollectionContainer Collection="{My Binding}"></CollectionContainer>
</CompositeCollection>
</my:uc.ItemsSource>
</my:uc>
我想這顯示在列表框中這些CollectionContainers的內容,但目前它不是通過容器枚舉。我的列表框顯示的唯一項目是兩個「System.Data.CollectionContainer」項目。
[b]編輯:[/ b]XAML設計者通知我「Property'ItemsSource'不支持'CompositeCollection'類型的值。我認爲這是我的問題..但我怎麼讓它「支持」CompositeCollection?
的問題是,CollectionContainer不應該表現自己所有,而是需要提供其子元素。 – 2009-06-28 14:26:10