Search code examples
listviewscrollwindows-store-apps

Nested ListView and Touch Scrolling?


I am developing a Windows Store app and I have a 2-level nested ListView. The child-listview height is always adjusted to the number of items it has, therefore the scrollbar for it should not be used / never appear.

My problem is, I want that when the user taps, holds, and tries to scroll ANYWHERE on the parent-list view, it should scroll the PARENT listview. This is for touch-devices. Unfortunately, I need the DataTemplate of the PARENT listview to be selectable. So when use tries to scroll, nothing happens.

I hope I make sense.

Is there anyway that I can trigger the Parent List View to scroll? If I click on what appears to be the border between the DataTemplate and then try to scroll from there, it works properly, but I want to have a touch-friendly experience where it feels natural to be able to scroll from anywhere.

Below is a rough code, I removed some of the unnecessary parts:

<ListView DragOver="DragOver"
      AllowDrop="True"  >
<ListView.ItemTemplate>
    <DataTemplate>
            <ListView ManipulationMode="None"
                    SelectionMode="Single"
                    ScrollViewer.VerticalScrollBarVisibility="Hidden"
                    CanDragItems="True" Drop="ListViewDrop" DragItemsStarting="DragStarting"
                    AllowDrop="True"  DragOver="DragOver" DragLeave="DragLeave"
                  >
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical" />
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
            </ListView>
    </DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemsPanel>
    <ItemsPanelTemplate>
        <StackPanel Orientation="Vertical"></StackPanel>
    </ItemsPanelTemplate>
</ListView.ItemsPanel>

Thank you!


Solution

  • Figure out the problem. My InnerListView had ManipulationMode="None". Removed it and it was ok.