【问题标题】:grid inside scrollviewer in windows phone 7.1windows phone 7.1中scrollviewer中的网格
【发布时间】:2012-02-15 08:33:23
【问题描述】:

我的应用程序中需要一个注册表单,我需要滚动,所以我做了以下操作

<ScrollViewer VerticalScrollBarVisibility="Visible" Height="780" MaxHeight="1800"
                  MaxWidth="477" VerticalAlignment="Top">
           <ScrollViewer.Content>
          <Grid Width="477" Height="728"  MaxHeight="1800">  
                  <!--   .......Form's Elements..... -->
                 </Grid>
      </ScrollViewer.Content>
</ScrollViewer>

没有滚动,我错过了什么?

【问题讨论】:

    标签: xaml windows-phone-7.1 windows-phone-7


    【解决方案1】:

    在使用ScrollViewer 时不应设置高度属性。如果您将其简化为以下内容,但仍然无法正常工作,那么是您项目中的其他因素阻止了它工作。

    <ScrollViewer>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Text="Hello" FontSize="320" />
            <TextBlock Grid.Row="1" Text="World" FontSize="320" />
        </Grid>
    </ScrollViewer>
    

    【讨论】:

      【解决方案2】:

      删除 ScrollViewer.Content - 部分,我有一个具有这种结构的应用程序,它工作正常:

      <ScrollViewer x:Name="ContentScrollViewer" Margin="0,0,0,8">
          <Grid Height="562">
              <!-- My elements -->
          </Grid>
      </ScrollViewer>
      

      【讨论】:

      • 这一行是经过多次绝望尝试后添加的,无论如何,我删除了它仍然得到相同的确切行为
      【解决方案3】:

      您的滚动查看器的高度为 780,而您的网格只有 728。为什么会有任何滚动?只有当网格高于 780 时,您才能滚动。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多