我有 2 件物品:
Title = new ObservableCollection<string>();
Author = new ObservableCollection<string>();
我想把它们放在ListBox
第一个Title 1和Author 1下面,然后是Title 2 ...。我怎么能用 , 做到这DataBinding
一点ListBox DataTemplate
?
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Label Foreground="Blue" Content="{Binding Title}"></Label>
<Label Foreground="Red" Content="{Binding Author}"></Label>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>