Search code examples
xamllistviewwindows-store-appswinrt-xamlwindows-store

Windows 8 - ListView using Horizontal items panel doesn't scroll


I have a ListView and I've simply replaced the ItemsPanel template with a StackPanel that's in horizontal mode, like so:

<ListView.ItemsPanel>
    <ItemsPanelTemplate>
        <VirtualizingStackPanel Orientation="Horizontal" />
    </ItemsPanelTemplate>
</ListView.ItemsPanel>

However the items don't extend beyond the right hand side of the screen and thus, there's effectively no scrolling in any direction.

I copied the code from a //build/ session, so what did I miss?


Solution

  • You missed the configuration of the scroll viewer like this:

    <ListView
       ScrollViewer.HorizontalScrollBarVisibility="Auto"
       ScrollViewer.HorizontalScrollMode="Enabled"
       ScrollViewer.VerticalScrollMode="Disabled" 
       ... > ...