Developer
Developer

Reputation: 4341

WrapGrid horizontal scroll Windows 8

I have next XAML for main grid:

<ListView Grid.Row="1" x:Name="NewsListBox">
            <ListView.Background>
                <SolidColorBrush Color="#FF006C67" Opacity="0.5"/>
            </ListView.Background>
            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapGrid Orientation="Vertical"/>
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>
        </ListView>

And it looks nice, how it is needed:

But it doesn't scroll the content!

Example

Ok, i add ScrollViewer:

<ScrollViewer Grid.Row="1" VerticalScrollMode="Disabled" ZoomMode="Disabled">
        <ListView Grid.Row="1" x:Name="NewsListBox">
            <ListView.Background>
                <SolidColorBrush Color="#FF006C67" Opacity="0.5"/>
            </ListView.Background>
            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapGrid Orientation="Vertical"/>
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>
        </ListView>
        </ScrollViewer>

And it stacks everything vertically:

Example

What am i doing wrong?

Upvotes: 4

Views: 2551

Answers (2)

Bobson
Bobson

Reputation: 21

You can try this

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

Upvotes: 1

Developer
Developer

Reputation: 4341

Found a solution. No ScrollViewer is needed.

Just had to replace ListView with GridView because ListView isn't designed for horizontal scrolling.

Upvotes: 5

Related Questions