Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LongListSelector not scrolling

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>
like image 687
Kenny Thompson Avatar asked Dec 31 '12 05:12

Kenny Thompson


2 Answers

Fix the Height of the Grid

<Grid x:Name="applications" Grid.Row="1" Height="400">
...long list code...
</Grid>
like image 65
nkchandra Avatar answered Nov 13 '22 11:11

nkchandra


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>
like image 21
Mattias Lindberg Avatar answered Nov 13 '22 11:11

Mattias Lindberg