【发布时间】:2010-06-29 21:11:55
【问题描述】:
我正在尝试将对象列表绑定到 ItemsControl。该对象只有两个属性:Movie(字符串)和 Actors(字符串数组)。我可以让绑定在电影中正常工作。但我无法弄清楚 Actors 数组的绑定。
<ItemsControl x:Name="MovieList">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Width="100">
<Border Margin="2">
<TextBlock Text="{Binding Movie, Mode=OneWay}" />
</Border>
<ListBox ItemsSource="{Binding Actors, Mode=OneWay}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<controlsToolkit:WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
有什么建议吗?
【问题讨论】:
标签: silverlight xaml