Wrappanel不会滚动

时间:2013-06-10 07:36:29

标签: windows-phone-7 windows-phone-8

我设置了ScrollViewer的高度,但它不会滚动。共有9张图片。 Wrappanel设置为每行显示2张图像。但这只显示了3行(6张图片)。什么似乎是问题?


<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"    Height="500">

    <toolkit:WrapPanel Margin="-3,-20,12,-3" Background="White"  ItemHeight="200" Orientation="Horizontal" ItemWidth="200" Height="600" Width="480" FlowDirection="LeftToRight">

    <Image Height="160" Name="image11" Source="/ImgBadges/Badge_1.png" Stretch="UniformToFill" Width="160" />

    <Image Height="160" Name="image12" Source="/ImgBadges/Badge_2.png" Stretch="UniformToFill" Width="160" />

    <Image Height="160" Name="image13" Source="/ImgBadges/Badge_3.png" Stretch="UniformToFill" Width="160" />

    <Image Height="160" Name="image14a" Source="/ImgBadges/Badge_3.png" Stretch="UniformToFill" Width="160" />

    <Image Height="160" Name="image15b" Source="/ImgBadges/Badge_3.png" Stretch="UniformToFill" Width="160" />

    <Image Height="160" Name="image16c" Source="/ImgBadges/Badge_3.png" Stretch="UniformToFill" Width="160" />

     <Image Height="160" Name="image17d" Source="/ImgBadges/Badge_3.png" Stretch="UniformToFill" Width="160" />

     <Image Height="160" Name="image18e" Source="/ImgBadges/Badge_3.png" Stretch="UniformToFill" Width="160" />

     <Image Height="160" Name="image19f" Source="/ImgBadges/Badge_3.png" Stretch="UniformToFill" Width="160" />

    </toolkit:WrapPanel>

</ScrollViewer>

1 个答案:

答案 0 :(得分:4)

您已将WrapPanel的高度强制为600.将要设置的高度更改为仅ScrollViewer上的高度,以便WrapPanel可以有无限空间来添加更多滚动时的项目:

<ScrollViewer Height="500" ...>
    <toolkit:WrapPanel ItemHeight="200" Orientation="Horizontal" ItemWidth="200" Width="480" FlowDirection="LeftToRight">
          ...
    </toolkit:WrapPanel>
</ScrollViewer>

摘要:从WrapPanel中删除高度,以便可以添加更多项目。