![](/img/trans.png)
[英]WP7 ScrollViewer programatically scroll a background ScrollViewer in sync with front ScrollViewer
[英]Auto SnapBack with scrollviewer on WP7
大家好,我在滚动时遇到问题,它总是会突然响起,有人可以帮助我找到错误吗:)谢谢! 更新,仍然无法正常工作
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Height="954" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="45"/>
<RowDefinition/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<!--ContentPanel - place additional content here-->
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Margin="12,17,0,28" />
<!--ContentPanel - place additional content here-->
<ScrollViewer HorizontalAlignment="Left" x:Name="scrollViewer1" VerticalAlignment="Stretch" Width="465" Margin="-9,0,0,0">
<Grid x:Name="ContentPanel" Margin="12,8,12,-226" Grid.RowSpan="2" >
<Grid Height="986" Margin="6,2,-37,730">
<Grid.RowDefinitions>
<RowDefinition Height="832*" />
<RowDefinition Height="154*" />
</Grid.RowDefinitions>
<StackPanel x:Name="stackPanel1" Margin="16,116,227,0" d:LayoutOverrides="HorizontalAlignment" Grid.RowSpan="2"></StackPanel>
<StackPanel x:Name="stackPanel2" Margin="0,173,9,-11" HorizontalAlignment="Right" Width="207" Grid.RowSpan="2"></StackPanel>
<Rectangle Height="50" HorizontalAlignment="Left" Margin="-26,33,0,0" Name="rectangle1" Stroke="Black" StrokeThickness="1" VerticalAlignment="Top" Width="359" Fill="#FFFF57CB" />
<TextBlock Height="51" HorizontalAlignment="Left" Margin="24,33,0,0" Name="textBlock1" Text="Case Taking" VerticalAlignment="Top" Width="311" FontWeight="SemiBold" FontSize="32" />
</Grid>
</Grid>
</ScrollViewer>
</Grid>
从您的ScrollViewer中删除Height =“ ...”并将其更改为VerticalAlignment =“ Stretch”
ScrollViewer将滚动其内容。 您正在执行的操作是为ScrollViewer提供较大的尺寸(具有“高度”),因此它认为不需要滚动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.