如何将列表项绑定到Wrap Panel, 我得到的结果如下:
1 2 3 4
但我想这样:
1 2 3 4 5 6 7 8
答案 0 :(得分:0)
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<Image Source="{Binding Icon}" Stretch="Uniform" HorizontalAlignment="Center" Height="50" Width="100"/>
<TextBlock Text="{Binding Name}" TextWrapping="Wrap" Foreground="White" FontSize="22" Height="30" Margin="10" Width="110" TextAlignment="Center"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<Controls:WrapPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>