WP7 ListBox 【1】 横向绑定数据 横向滚动

<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彻底改造成了一个横向的,而且这样竖向上不能滑动,更好的体验。

posted @ 2012-08-09 15:48  boypig  阅读(1915)  评论(0)    收藏  举报