喜,列表项模板
所以让我们假设我有这个ListBox.ItemTemplate:
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="DataTemplate1">
<StackPanel Orientation="Horizontal">
<StackPanel Height="100" Width="100">
<TextBlock TextWrapping="Wrap" Text="{Binding name}" FontWeight="Bold"/>
<TextBlock TextWrapping="Wrap" Text="{Binding age}" FontWeight="Bold"/>
</StackPanel>
<StackPanel Height="100" Width="100">
<Image Height="100"/>
<Image Height="100"/>
</StackPanel>
<StackPanel Height="100" Width="100">
<TextBlock TextWrapping="Wrap" Text="blah blah" FontSize="13.333"/>
<TextBlock TextWrapping="Wrap" Text="{Binding something}"/>
</StackPanel>
<StackPanel Height="100" Width="100">
<TextBlock TextWrapping="Wrap" Text="Time" FontSize="13.333"/>
<TextBlock TextWrapping="Wrap" Text="45 minutes"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
我想实现的是,不知何故在第二图像的数StackPanel中,这一个:
<StackPanel Height="100" Width="100">
<Image Height="100"/>
<Image Height="100"/>
</StackPanel>
是动态的,两个用于某些列表框中的项目,3或4人。
我想知道是否有可能实现这与绑定和模板? 我不想在代码中手动执行此操作。