Question

It seems that xaml is not my thing. The title says it all.

<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>

The Screen automatically goes back to its previous location and the scroll is not complete. It just moves down and than back again like an elastic.

ScrollViewer is not scrolling, the elements inside the ScrollViewer are longest than the StackPanel that contains the ScrollViewer. When I try to scroll, it bounces.

Thank you.

Was it helpful?

Solution

Edited my answer. Tried this in VS and found out the error. ListBox doesn't require ScrollViewer at all and you had Height="Auto". That means it will expand the ListBox to needed height, thus disabling the scrollability from it. And also you don't need both StackPanel and Grid inside the DataTemplate.

<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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top