2014-10-05 92 views
0

我正在爲Windows Phone 8.1構建應用程序,滾動查看器後滾動查看器會一直返回頂部。就像我把它拖下來,當我釋放它時,它會回到頂端。Windows Phone 8.1滾動查看器

<ScrollViewer Margin="10,0,10,-1024" Height="1124" VerticalAlignment="Top" 
    VerticalScrollBarVisibility="Visible" VerticalScrollMode="Enabled" 
    AllowDrop="False" BringIntoViewOnFocusChange="True" 
    HorizontalScrollMode="Disabled" IsHoldingEnabled="True" > 

    <Grid Grid.Row="1" x:Name="ContentRoot" Height="468" Width="386" > 

     <TextBlock HorizontalAlignment="Left" Margin="64,326,0,0" 
      TextWrapping="Wrap" VerticalAlignment="Top" Foreground="White" 
      FontSize="16" Width="307" Height="68" > 

      <Run Foreground="#FFFF6767" Text="Single Phase "/> 
      <Run Foreground="#FFFF6767" Text="Amperes "/> 
      <Run Text="= "/> 
      <Run Text="(746 x Horsepower)/(Volts x Efficiency x Power Factor"/> 
      <Run Text=")"/> 

     </TextBlock> 

    </Grid> 

</ScrollViewer> 

回答

6

ScrollViewer設計用於處理大於周圍容器的內容。所以通常你的ScrollViewer的高度比它的內容小。

只要調整您的ScrollViewer和內容,例如:

<ScrollViewer Height="500" VerticalAlignment="Top" VerticalScrollBarVisibility="Visible" VerticalScrollMode="Enabled" AllowDrop="False" BringIntoViewOnFocusChange="True" HorizontalScrollMode="Disabled" IsHoldingEnabled="True" > 
<Grid Grid.Row="1" x:Name="ContentRoot" Height="800" Width="386" > 
[..] 

</Grid> 
</ScrollViewer> 

在你的情況的高度網格比ScrollViewer中小得多,所以我不期望你所描述的行爲。