2014-04-07 157 views
1

看來xaml不是我的東西。標題說明了一切。ScrollViewer不滾動Windows Phone 8

<phone:Panorama Title="MSFT Insider" Background="#FFD8D8D8" Foreground="Black" Style="{StaticResource PanoramaStyle1}"> 

      <!--Elemento Panorama uno--> 
      <phone:PanoramaItem Header="Portada" FontSize="20"> 
       <StackPanel HorizontalAlignment="Left" Width="416"> 
        <ScrollViewer Height="Auto" Width="416" HorizontalAlignment="Left" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto"> 

         <ListBox x:Name="frontpost_list" Width="416" Height="Auto" Margin="0,0,0,0" VerticalAlignment="Top" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden"> 
           <ListBox.ItemTemplate> 
            <DataTemplate> 
            <StackPanel HorizontalAlignment="Left" Height="Auto" VerticalAlignment="Top" Width="416"> 
             <Grid Width="415" Height="240"> 
              <Image Source="Assets/PanoramaBackground.png" Stretch="UniformToFill" Height="240" Width="415"/> 
              <TextBlock VerticalAlignment="Bottom" FontSize="29.333" FontWeight="Bold" Margin="10,0,10,20" UseLayoutRounding="True" Padding="0" TextWrapping="Wrap" TextTrimming="WordEllipsis" Text="{Binding Title}" FontFamily="Arial" CharacterSpacing="1" Foreground="Black"/> 
             </Grid> 
            </StackPanel> 
           </DataTemplate> 
           </ListBox.ItemTemplate> 
          </ListBox> 
        </ScrollViewer> 
       </StackPanel> 
       <!--Lista de una línea con ajuste automático de texto--> 
      </phone:PanoramaItem> 

屏幕自動返回到其先前的位置,並且滾動沒有完成。它只是向下移動,而不是像彈性一樣向後移動。

ScrollViewer不滾動,ScrollViewer內部的元素比包含ScrollViewer的StackPanel最長。當我嘗試滾動時,它會彈跳。

謝謝。

回答

2

編輯我的答案。在VS試過這個,發現了錯誤。 ListBox根本不需要ScrollViewer,並且您有Height="Auto"。這意味着它會將ListBox擴展到所需的高度,從而禁用它的可滾動性。而且你也不需要DataTemplate中的StackPanel和Grid。

<phone:PanoramaItem Header="Portada" FontSize="20"> 
      <StackPanel HorizontalAlignment="Left" Width="416"> 
        <ListBox x:Name="frontpost_list" Width="416" Height="400" Margin="0,0,0,0"> //Notice the height 
         <ListBox.ItemTemplate> 
          <DataTemplate> 
           <StackPanel HorizontalAlignment="Left" Height="Auto" VerticalAlignment="Top" Width="416"> 
            <Image Source="Assets/PanoramaBackground.png" Stretch="UniformToFill" Height="240" Width="415"/> 
            <TextBlock VerticalAlignment="Bottom" FontSize="29.333" FontWeight="Bold" Margin="10,0,10,20" UseLayoutRounding="True" Padding="0" TextWrapping="Wrap" TextTrimming="WordEllipsis" Text="{Binding Title}" FontFamily="Arial" CharacterSpacing="1" Foreground="Black"/> 
           </StackPanel> 
          </DataTemplate> 
         </ListBox.ItemTemplate> 
        </ListBox> 
      </StackPanel> 
      <!--Lista de una línea con ajuste automático de texto--> 
     </phone:PanoramaItem> 
+0

謝謝,沒有解決問題。 – Adelaiglesia

+0

你想要滾動什麼元素? – Sopuli

+0

列表框「frontpost_list」 – Adelaiglesia