1

I am building an application which requires a horizontal list of vertical lists

Simplified XAML layout:

<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>

I am having trouble getting the touch interactions right. Currently horizontal swipes move the entire list horizontally, and vertical move individual lists' items vertically. However it is possible to move both lists with a diagonal swipe, and it's not possible to scroll multiple vertical lists at a time (it is without the outer scrollviewer).

Is there a way to make all horizontal swipes apply only to the outer scrollviewer, and all vertical swipes only to an inner listview?

4

1 回答 1

1

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

您还可以ScrollViewer.IsHorizontalRailEnabled在 aGridViewScrollViewer.IsVerticalRailEnableda上设置类似的内容,ListView而无需提取模板来访问它们的ScrollViewers.

于 2013-04-15T21:03:57.823 回答