似乎xaml不是我的事。标题说明了一切。
<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最长。当我尝试滚动时,它会反弹。
谢谢。
答案 0 :(得分: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>