导航

关于WinRT中的轨道滚动(Rail)

Posted on 2013-01-25 10:49  Bullatus  阅读(266)  评论(0)    收藏  举报

开始一直没怎么理解IsVerticalRailEnabledIsHorizontalRailEnabled做什么用的,后来因为要嵌套FlipView,出现了一个问题,就是拖动时可以两个方向同时移动,但如果嵌入的是ListBox则同时只能在一个方向上移动。

示例XAML如下

<FlipView>
    <FlipView>
        <FlipView.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
        </FlipView.ItemsPanel>
        <Rectangle Fill="CornflowerBlue" />
        <Rectangle Fill="CornflowerBlue" />
    </FlipView>
    <FlipView>
        <FlipView.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
        </FlipView.ItemsPanel>
        <Rectangle Fill="CornflowerBlue" />
        <Rectangle Fill="CornflowerBlue" />
    </FlipView>
    <ListBox>
        <Rectangle Fill="CornflowerBlue" />
        <Rectangle Fill="CornflowerBlue" />
    </ListBox>
</FlipView>

后来分别导出ListBox和FlipView的Template对比,然后进行了一定的尝试才“领悟”到Rail是神马意思,就是……轨道嘛……只能往轨道的方向移动……