首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Windows Mobile >

怎样实现一个Grid样式的ListBox,该如何解决

2012-03-11 
怎样实现一个Grid样式的ListBox现在的视图是这样的:item1item2item3item4item5item6我想做成这样的:item1i

怎样实现一个Grid样式的ListBox
现在的视图是这样的:
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>

热点排行