【问题标题】:Cross-slide with nested scrollviewers in WinRT Xaml在 WinRT Xaml 中使用嵌套滚动查看器进行横向滑动
【发布时间】:2013-04-16 05:03:57
【问题描述】:

我正在构建一个需要垂直列表的水平列表的应用程序

简化的 XAML 布局:

<ScrollViewer>
    <ItemsControl ItemsSource="{Binding Lists}">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <ListView ItemsSource="{Binding Items}"/>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</ScrollViewer>

我无法正确进行触摸交互。目前水平滑动水平移动整个列表,垂直移动单个列表的项目。但是,可以通过对角滑动来移动 两个 列表,并且不能一次滚动多个垂直列表(它没有外部滚动查看器)。

有没有办法让所有水平滑动只适用于外部滚动查看器,而所有垂直滑动只适用于内部列表视图?

【问题讨论】:

    标签: listview winrt-xaml scrollviewer


    【解决方案1】:

    如果您在两个 ScrollViewers 上设置 IsHorizontalRailEnabled/IsVerticalRailEnabled 属性,您可能会得到想要的效果。

    您还可以在GridView 上设置ScrollViewer.IsHorizontalRailEnabled 或在ListView 上设置ScrollViewer.IsVerticalRailEnabled 之类的内容,而无需提取模板以访问其ScrollViewers

    【讨论】:

    • 非常感谢!花了 3 个小时在互联网上搜索“IsHorizontalRailEnabled 是做什么的?”的答案。我什至不需要它,但正在努力寻找。 (总有一天会因为好奇而死)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-03
    • 1970-01-01
    • 2015-12-06
    相关资源
    最近更新 更多