I'm trying to add vertical scrolling to my GridView / AdaptiveGridView, but no success so far(Horizontal scrolling works).

I have already attempted with internal scrollviewer with the "ScrollViewer.---" in the GridView without luck.

I have also tried to place a ScrollViewer outside of the GridView without luck.

XAML

<ScrollViewer
    HorizontalScrollBarVisibility="Disabled"
    HorizontalScrollMode="Disabled"
    VerticalScrollBarVisibility="Auto"
    VerticalScrollMode="Auto">
    <Grid Name="ChangeMe">
        <controls:AdaptiveGridView
            Name="MyPolls"
            Margin="0,10,0,0"
            DesiredWidth="320"
            IsItemClickEnabled="True"
            ItemClick="MyPolls_ItemClick"
            ItemHeight="180"
            ItemsSource="{x:Bind oc}"
            SizeChanged="MyPolls_SizeChanged">
            <controls:AdaptiveGridView.ItemTemplate>
                <DataTemplate x:DataType="local:Poll">
                    <Grid ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollMode="Auto">
                        <Image Source="../Assets/Square44x44Logo.png" Stretch="UniformToFill" />
                        <StackPanel
                            Height="60"
                            Padding="12"
                            VerticalAlignment="Bottom"
                            Background="{ThemeResource SystemBaseLowColor}"
                            Orientation="Horizontal">
                            <StackPanel>
                                <TextBlock Text="{x:Bind poll_title}" />
                                <TextBlock
                                    Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
                                    Style="{ThemeResource CaptionTextBlockStyle}"
                                    Text="{Binding poll_description}" />
                            </StackPanel>
                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </controls:AdaptiveGridView.ItemTemplate>
        </controls:AdaptiveGridView>
    </Grid>
</ScrollViewer>

Code Behind

private void MyPolls_SizeChanged(object sender, Windows.UI.Xaml.SizeChangedEventArgs e)
        {
            ChangeMe.Height = MyPolls.Height;
            ChangeMe.Width = MyPolls.Width;
        }

Does anyone know a way to enable vertical scrolling for a GridView / AdaptiveGridView for when the gridview items go out of frame so you can scroll down and see them? (AdaptiveGridView inherits from GridView)

0 Answers