LongListSelector not scrolling
Asked Answered
B

3

5

I am having trouble getting my long list selector to work properly. When the list is taller than the screen, the long list selector stays static and I am unable to scroll to see all of the items.

Any thoughts?

<phone:PivotItem Header="{Binding Path=LocalizedResources.ApplicationsHeader, Source={StaticResource LocalizedStrings}}" x:Name="applicationsPivotItem">
    <Grid x:Name="applications" Grid.Row="1">
        <phone:LongListSelector x:Name="MainLongListSelector" ItemsSource="{Binding Items}" SelectionChanged="MainLongListSelector_SelectionChanged">
            <phone:LongListSelector.ItemTemplate>
                <DataTemplate>
                    <StackPanel>
                        <TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                        <TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
                    </StackPanel>
                </DataTemplate>
            </phone:LongListSelector.ItemTemplate>
        </phone:LongListSelector>
    </Grid>
</phone:PivotItem>
Barge answered 31/12, 2012 at 5:25 Comment(0)
W
8

Fix the Height of the Grid

<Grid x:Name="applications" Grid.Row="1" Height="400">
...long list code...
</Grid>
Winonawinonah answered 31/12, 2012 at 6:16 Comment(1)
Doesn't this generally go against the guidelines for creating a responsive design? Setting an explicit height like that can cause UI strangeness when running the app on devices with different resolutions.Triglyph
O
7

I had a similar issue where my panoramaItem was defines as below:

            <phone:PanoramaItem>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <phone:LongListSelector x:Name="SpeciesList" Grid.Row="0">
                        <phone:LongListSelector.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="0,-6,0,12">
                                    <TextBlock Text="{Binding PrimaryName}"/>
                                </StackPanel>
                            </DataTemplate>
                        </phone:LongListSelector.ItemTemplate>
                    </phone:LongListSelector>
                </Grid>
            </phone:PanoramaItem>

By changing the RowDefinition to use * instead of Auto, my scrolling issues was resolved! As shown below.

                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
Onshore answered 31/7, 2013 at 22:21 Comment(1)
This is a better solution than the accepted answer.Subdue
M
1

I had the same issue with the LongListSelector not scrolling. In the end it was OpacityMask="White" that was set in LongListSelector that was causing the issue as per this question

Also as per Mattias I didn't have to set a specific Height, as long as the grid RowDefinition was set to *.

Moneywort answered 7/8, 2013 at 1:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.