[英]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.