Chris
Chris

Reputation: 1539

Silverlight PivotItem not scrolling down

PivotItem can't scroll down... Anyone has any ideas as to how I can remedy this?

For whatever the reason just won't scroll down when content that is bound inside the listbox is longer than the height of the page. I tried adding a grid inside the pivotitem with height set to auto, but to no avail.

<Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
            <controls:Pivot Height="Auto">
                <controls:PivotItem Header="Main Information">
                <Border CornerRadius="10" Background="#FF5C7590" Height="Auto" Padding="2" BorderThickness="1">
                    <ListBox x:Name="lbxPropertyItems">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="200" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Margin="5, 0, 0, 0" Grid.Column="0" Text="{Binding Label}" />
                                    <TextBlock Grid.Column="1" Text="{Binding Value}" TextWrapping="Wrap" />
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Border>
            </controls:PivotItem>
</controls:Pivot>
</Grid>

Thanks for any advice.

Upvotes: 0

Views: 461

Answers (1)

Nikos Miliotis
Nikos Miliotis

Reputation: 26

The issue is that a StackPanel has an infinite layout space in which ever orientation it is set, so the ScrollViewer included in the ListBox never gets activated in that direction. The best way to handle it is to host it inside a Grid control with row or column definitions.

Upvotes: 1

Related Questions