码迷,mamicode.com
首页 > Windows程序 > 详细

WPF listbox实现多列显示数据

时间:2016-01-17 14:48:36      阅读:469      评论:0      收藏:0      [点我收藏+]

标签:

一.每行显示固定列数

<ListBox ItemsSource="{Binding DataList}" Style="{DynamicResource ListBoxStyle}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <UniformGrid Columns="3"/>
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            ...
                        </DataTemplate>
                    </ListBox.ItemTemplate>
</ListBox>

二.每行显示列数随宽度变化

<ListBox ItemsSource="{Binding DataList}" Style="{DynamicResource ListBoxStyle}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>          
                            <WrapPanel IsItemsHost="True"/>
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            ...
                        </DataTemplate>
                    </ListBox.ItemTemplate>
</ListBox>

 

WPF listbox实现多列显示数据

标签:

原文地址:http://www.cnblogs.com/CitySnail/p/5137157.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!