水平ScrollViewer Windows Phone

时间:2014-08-14 05:35:28

标签: windows-phone-8 scrollviewer

我是Windows手机的新手,我是Android和iOS开发者。试图在Windows上复制我的应用程序。无论如何,我正在寻找一种方法来使用scrollview来翻页12个按钮,每页6个,每个页面上的6个将是网格形式,3行2列。我不知道如何去做。请任何帮助将不胜感激。只是给我一点提示并不会是坏事。感谢

2 个答案:

答案 0 :(得分:1)

将此添加到您的每个页面。

<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>

        <Button Grid.Column="0" Grid.Row="0" Content="Button" />
        <Button Grid.Column="0" Grid.Row="1" Content="Button" />
        <Button Grid.Column="0" Grid.Row="2" Content="Button" />
        <Button Grid.Column="1" Grid.Row="0" Content="Button" />
        <Button Grid.Column="1" Grid.Row="1" Content="Button" />
        <Button Grid.Column="1" Grid.Row="2" Content="Button" />
    </Grid>
</ScrollViewer>

答案 1 :(得分:0)

我认为你正在寻找这个:

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled">
    <Grid Width="960" >
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Button Content="1" Margin="10"></Button>
        <Button Content="2" Grid.Row="1" Margin="10"></Button>
        <Button Content="3" Grid.Row="2" Margin="10"></Button>

        <Button Content="4" Grid.Column="1" Margin="10"></Button>
        <Button Content="5" Grid.Row="1" Grid.Column="1" Margin="10"></Button>
        <Button Content="6" Grid.Row="2" Grid.Column="1" Margin="10"></Button>

        <Button Content="7" Grid.Column="2" Margin="10"></Button>
        <Button Content="8" Grid.Row="1" Grid.Column="2" Margin="10"></Button>
        <Button Content="9" Grid.Row="2" Grid.Column="2" Margin="10"></Button>

        <Button Content="10" Grid.Column="3" Margin="10"></Button>
        <Button Content="11" Grid.Row="1" Grid.Column="3" Margin="10"></Button>
        <Button Content="12" Grid.Row="2" Grid.Column="3" Margin="10"></Button>
    </Grid>
    </ScrollViewer>
</Grid>

我在这里添加了图片:

启动时有6个项目的页面

Page with 6 items at startup

滚动另外6个项目后

After Scrolling Another 6 Items