0
votes

Test in Simulator mode, the GridView wont scroll vertically even I have 100 records to show, it show a vertical bar but can not be used to scroll. What I need to do to make it scrolling vertically or horzontally?

Your help is appreciated for this problem. Thanks

<GridView x:Name="CustomersGridView" 
     Grid.Row="1"
     Margin="37,174,73,89"
     Foreground="White"     
     SelectionMode="Single"
     IsSwipeEnabled="True"
     IsItemClickEnabled="True"
     ItemsSource="{Binding Mode=OneWay, Source={StaticResource CustomersViewSource}}" 
     ItemTemplate="{StaticResource CustomerTemplate}"
     ItemClick="CustomersGridView_ItemClick"

    // Horizontal or vertical here:          
     ScrollViewer.HorizontalScrollBarVisibility="Auto"

     SelectionChanged="CustomersGridView_SelectionChanged">

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

</GridView>



1

1 Answers

2
votes

Wrap the control in a ScrollViewer

For example:

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      WindowTitle="ScrollViewer Sample">
  <ScrollViewer HorizontalScrollBarVisibility="Auto">
    <StackPanel VerticalAlignment="Top" HorizontalAlignment="Left">
      <TextBlock TextWrapping="Wrap" Margin="0,0,0,20">Scrolling is enabled when it is necessary. 
      Resize the window, making it larger and smaller.</TextBlock>
      <Rectangle Fill="Red" Width="500" Height="500"></Rectangle>
    </StackPanel>
  </ScrollViewer>
</Page>