locked
Нет скроллинга в GridView RRS feed

  • Вопрос

  • Помогите пожалуйста разобраться.

    Программа из SQLITE выводит список людей.

    Нет скроллинга?? Выводится список только то что вместится на экран.

    <common:LayoutAwarePage
        x:Name="pageRoot"
        x:Class="Peoples.Views.MainPage"
        DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:Peoples.Views"
        xmlns:common="using:Peoples.Common"
        xmlns:converters="using:Peoples.Converters"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
    
        <Page.Resources>
            <ResourceDictionary>
                <CollectionViewSource x:Name="PeoplesViewSource" />
    
                <DataTemplate x:Key="PeopleTemplate">
    
                    <Grid 
                        Width="280" 
                        Height="280">
                        <Grid.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="Black" Offset="0"/>
                                <GradientStop Color="White" Offset="1"/>
                            </LinearGradientBrush>
                        </Grid.Background>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="280"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" VariableSizedWrapGrid.ColumnSpan="2" VariableSizedWrapGrid.RowSpan="2">
                            <Image x:Name="image" Source="{Binding Image}" Stretch="UniformToFill"/>
                        </Border>
                        <StackPanel VerticalAlignment="Bottom" 
                                    Background="{StaticResource 
                                    ListViewItemOverlayBackgroundThemeBrush}">
                            <TextBlock Text="{Binding Name}" 
                                       Grid.Row="0"
                                       Margin="20,10,0,0" 
                                       TextWrapping="Wrap"
                                       VerticalAlignment="Top"
                                       FontSize="24"
                                       FontWeight="SemiBold"/>
                            <TextBlock Text="{Binding Description}" 
                                       Grid.Row="2"
                                       Margin="20,0,0,0" 
                                       VerticalAlignment="Top"
                                       FontSize="18"/>
                        </StackPanel>
                    </Grid>
    
                </DataTemplate>
    
            </ResourceDictionary>
        </Page.Resources>
        <Page.BottomAppBar>
            <AppBar x:Name="MainPageAppBar"
                    Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal">
                        <Button x:Name="AddButton" 
                                Style="{StaticResource AddAppBarButtonStyle}" 
                                Loaded="StartLayoutUpdates"
                                Unloaded="StopLayoutUpdates"
                                Click="AddButton_Click"/>
                        <Button x:Name="EditButton" 
                                Style="{StaticResource EditAppBarButtonStyle}" 
                                Loaded="StartLayoutUpdates"
                                Unloaded="StopLayoutUpdates"
                                Click="EditButton_Click"/>
                    </StackPanel>
                    <StackPanel Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
                        <Button x:Name="Exit" HorizontalAlignment="Right" Style="{StaticResource AppBarButtonStyle}" Click="OnExitButtonClicked" Content="Exit" />
                    </StackPanel>
                </Grid>
            </AppBar>
        </Page.BottomAppBar>
    
        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
            <Grid.RowDefinitions>
                <RowDefinition Height="140"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
    
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBlock x:Name="PageTitle" 
                           Text="My People`s" 
                           Grid.Column="1" 
                           VerticalAlignment="Center"
                           Margin="120,20,0,0"
                           IsHitTestVisible="false" 
                           Style="{StaticResource PageHeaderTextStyle}"/>
            </Grid>
    
            <GridView x:Name="PeoplesGridView" 
                      Grid.Row="1"
                      Margin="110,50,0,0"
                      Foreground="White"     
                      SelectionMode="Single"
                      IsSwipeEnabled="True"
                      IsItemClickEnabled="True"
                      ItemsSource="{Binding Mode=OneWay, Source={StaticResource PeoplesViewSource}}" 
                      ItemTemplate="{StaticResource PeopleTemplate}"
                      ItemClick="PeoplesGridView_ItemClick"
                      SelectionChanged="PeoplesGridView_SelectionChanged" ShowsScrollingPlaceholders="False">
                <GridView.Background>
                    <ImageBrush Stretch="Fill"/>
                </GridView.Background>
                <GridView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapGrid Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </GridView.ItemsPanel>
            </GridView>
    
            <VisualStateManager.VisualStateGroups>
    
                <!-- Visual states reflect the application's view state -->
                <VisualStateGroup x:Name="ApplicationViewStates">
                    <VisualState x:Name="FullScreenLandscape"/>
                    <VisualState x:Name="Filled"/>
    
                    <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                    <VisualState x:Name="FullScreenPortrait">
                        <!--<Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackButton" Storyboard.TargetProperty="Style">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>-->
                    </VisualState>
    
                    <!-- The back button and title have different styles when snapped -->
                    <VisualState x:Name="Snapped">
                        <!--<Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackButton" Storyboard.TargetProperty="Style">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PageTitle" Storyboard.TargetProperty="Style">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>-->
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
        </Grid>
    </common:LayoutAwarePage>
    

    23 декабря 2013 г. 14:44

Ответы

  • Оказалось все просто

                      ScrollViewer.HorizontalScrollBarVisibility="Visible"
    

    • Помечено в качестве ответа Dmitriy Konyuhov 23 декабря 2013 г. 17:40
    23 декабря 2013 г. 17:40