您的位置:首页 > 其它

WPF/Silverlight ListBox 数据横向显示的实现

2011-04-21 23:47 351 查看
<ListBox x:Name="imgList" Width="Auto" Height="Auto" Margin="0" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemsSource="{Binding}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate >
<DataTemplate>
<Image Source="{Binding ImagePath}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>


关键代码:

1.ScrollViewer.VerticalScrollBarVisibility="Disabled"

2. <ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: