Ara*_*yan 13 wpf wrappanel silverlight-toolkit windows-phone-7
我想在WrapPanel中显示一个图像列表.我怎么能这样做或者我会使用其他控制?
小智 24
您绝对可以使用WrapPanel显示图像列表,垂直或水平滚动.要使用图像在People中心获得全景图块效果,您可以执行以下操作:
<controls:PanoramaItem Header="something" Orientation="Horizontal" Margin="0,-15,0,0" >
<ListBox Name="SomeList" Margin="0,0,-12,0" ItemsSource="{Binding SomeItemsList}" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel x:Name="wrapPanel" Width="700" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,17">
<Image Height="200" Width="200" Margin="12,0,9,0" Source="{Binding ImageURL}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>
Run Code Online (Sandbox Code Playgroud)
请注意,ListBox中的WrapPanel确实会选择您定义的DataTemplate.因此您可以完全自由地将任何列表绑定到WrapPanel.
希望这可以帮助!
小智 10
搜索相同的内容并遇到了这个:Displaying a Collection of Items in a WrapPanel。
<ItemsControl ItemsSource="{Binding ActorList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Image Source="{Binding Image}" Height="100"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)
或者您可以使用Xceed 的 SwitchPanel。
| 归档时间: |
|
| 查看次数: |
10732 次 |
| 最近记录: |