我想为我的ListBox指定多个列,但是我的googling技巧在这一点上失败了。
如何修改ItemsPanelTemplate的ListBox以自定义所显示的列?
编辑:忘了把我已经试过的东西
我试过了密码
<ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
<UniformGrid Columns="3" />
</ItemsPanelTemplate>除了我失去了垂直滚动条外,这是可行的。
发布于 2012-07-11 19:14:03
这里是一个简单的例子,我认为您正在寻找,有3列,项目包装,和自动垂直滚动将根据周围的布局工作。
<ListBox HorizontalContentAlignment="Stretch">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="3"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border MinHeight="150" Margin="5" Background="Green" CornerRadius="4">
<TextBlock Text="{Binding}" Foreground="White"/>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
<System:String>One</System:String>
<System:String>Two</System:String>
<System:String>Three</System:String>
<System:String>Four</System:String>
<System:String>Five</System:String>
<System:String>Six</System:String>
<System:String>Seven</System:String>
<System:String>Eight</System:String>
<System:String>Nine</System:String>
<System:String>Ten</System:String>
</ListBox>https://stackoverflow.com/questions/11436499
复制相似问题