locked
How to listView horizontal arrangement in metro App? RRS feed

  • Question

  • How to listView horizontal arrangement in metro App?

    thanks...

    Tuesday, December 20, 2011 5:38 AM

Answers

  • You can control the ListView's panel by defining the ItemsPanel to use a horizontal control.  For example, if you look at the ListViewSimple sample you can change the Orientation of the VirtualizingStackPanel in the ListView syle's ItemsPanelTemplate from this:

    <Setter Property="ItemsPanel">
          <Setter.Value>
            <ItemsPanelTemplate>
              <VirtualizingStackPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
          </Setter.Value>
        </Setter>
    
    to this:

        <Setter Property="ItemsPanel">
          <Setter.Value>
            <ItemsPanelTemplate>
              <VirtualizingStackPanel Orientation="Horizontal" />
            </ItemsPanelTemplate>
          </Setter.Value>
        </Setter>
    

    You will probably want to update the ListViewItem style to look appropriate for horizontal scrolling.

    --Rob

    Tuesday, December 20, 2011 9:35 PM
    Moderator