AnneP
AnneP

Reputation: 53

UWP - horizontally scrollable view inside grid view

I'm creating a sort of bookkeeper and would like to make each section horizontally scrollable (kinda like ibooks). I have tried to wrap my Gridview with ScrollViewer but that messed up. Thanks for help! Here's my code snippet:

<ScrollViewer Margin="10,0,0,0">
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="5,10,5,5">
        <Grid.RowDefinitions>
            <RowDefinition Height="60"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
        <TextBlock Text="Romances" FontSize="18"/>           
        <GridView Name="JuvenileBooks"  Grid.Row="1"
                  HorizontalAlignment="Stretch" 
                  VerticalAlignment="Stretch" >
            <GridView.ItemTemplate>
                <DataTemplate x:DataType="data:BookModel">
                    <local:BookshelvesDataTemplate/>
                </DataTemplate>
            </GridView.ItemTemplate>
        </GridView>
</ScrollViewer>

Upvotes: 1

Views: 338

Answers (1)

Ali NGame
Ali NGame

Reputation: 464

I think this is the thing you are looking for

<GridView >
    <GridView.ItemsPanel>
        <ItemsPanelTemplate>
            <ItemsWrapGrid Orientation="Horizontal"/>
        </ItemsPanelTemplate>
    </GridView.ItemsPanel>
</GridView>

Upvotes: 2

Related Questions