<ListBox x:Name=
"imageListBox"
ScrollViewer.HorizontalScrollBarVisibility=
"Visible"
ScrollViewer.VerticalScrollBarVisibility =
"Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation=
"Horizontal"></StackPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
其中
1 <ListBox.ItemsPanel> 修改了存放这些ListBoxItem的容器。修改成了StackPanel 容器,并且设置为横向排放这样放入的Items就能自动为横向。
2 ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility = "Disabled" 是修改了ListBox的横竖方向的滑动控制。 因为ListBox里面是通过一个ScrollViewer来控制内容展示时的滑动。这样就将一个竖向的ListBox彻底改造成了一个横向的,而且这样竖向上不能滑动,更好的体验。
转载于:https://www.cnblogs.com/boypig/archive/2012/08/09/2630400.html
相关资源:数据结构—成绩单生成器