现在的视图是这样的:
item1
item2
item3
item4
item5
item6
我想做成这样的:
item1 item2
item3 item4
item5 item6
------解决方案--------------------
WrapPanel
用这个控件
在toolkit里面的
自己应该会添加吧
------解决方案--------------------
用WrapPanel
实现自动折行!
<ListBox Name="ListChannel" Margin="0,-50,10,0" ItemsSource="{Binding ChannelList}" Height="530" SelectedIndex="{Binding ChannelliIndex,Mode=TwoWay}" Foreground="{StaticResource WhiteBrushKey}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel Width="400" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="5,0,5,10" Width="180">
<Rectangle Width="172" Height="172" Fill="#FF830F49"></Rectangle>
<Image Height="172" Width="172" Source="{Binding ImgUrl}" Margin="0,10,0,0" />
<TextBlock Text="{Binding nodeName}" HorizontalAlignment="Center" TextWrapping="NoWrap" FontSize="22" Margin="50,130,50,0" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ListBox>