Reputation: 128
ObservableCollection<A> work = new ObservableCollection<A>();
Class A
{
int a;
int b;
observablecollection<string> c;
}
I need to bind" work" as the Itemsource of combobox and selectedItem as A. But I need to display the strings(c) of class A in the combobox. How will I display the strings C in the combobox. Any idea.?
Upvotes: 1
Views: 680
Reputation: 17380
well if you need each ComboBoxItem
to display a collection of strings, use an ItemsControl
in the ItemTemplate
of ComboBox
.
<ComboBox ItemsSource="{Binding work}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text={Binding a} />
<TextBlock Text={Binding b} />
<ItemsControl ItemsSource="{Binding c}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
Upvotes: 3