user3228701
user3228701

Reputation: 1

WP8 ListBox not scrolling

I'm developing a WP8 app and I have scroll problems. In my page I have a grid and two listbox. Why in your opinion? I tried also using ScrollViewer but good results.

<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="auto"/>
        <RowDefinition Height="auto"/>
    </Grid.RowDefinitions>

    <TextBlock Name="txt" TextAlignment="Center" 
               FontWeight="Bold"
               FontSize="36" Height="auto" Grid.ColumnSpan="2" Grid.Row="0"></TextBlock>

    <ListBox Name="lstCasa" Grid.Column="0" Grid.Row="1">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Vertical">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                    </Grid>
                    <TextBlock FontWeight="Bold" Text="{Binding Path=aaa}"/>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
    <ListBox Name="lstFuori" Grid.Column="1" Grid.Row="1">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Vertical">
                    <TextBlock FontWeight="Bold" Text="{Binding Path=bbb}"/>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
</Grid>

Upvotes: 0

Views: 768

Answers (1)

Chris W.
Chris W.

Reputation: 23280

Height="Auto" on your RowDefinition doesn't give anything to invoke the ScrollViewer

It needs a boundary to tell it "Hey you reached the end of where you're allowed to display, any further and it's going to require scrolling."

Make sense?

To fix it, you could put your RowDefinition to "*" or a fixed height on either that Row or the ListBox(s) or something equivalent to establish a boundary point.

Hope this helps.

Upvotes: 2

Related Questions