0

PivotItem 无法向下滚动...有人对我如何解决这个问题有任何想法吗?

无论出于何种原因,当绑定在列表框内的内容长于页面高度时,都不会向下滚动。我尝试在枢轴项内添加一个高度设置为自动的网格,但无济于事。

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

感谢您的任何建议。

4

1 回答 1

1

问题是 StackPanel 有一个无限的布局空间,无论它设置的方向是什么,所以 ListBox 中包含的 ScrollViewer 永远不会在那个方向上被激活。处理它的最佳方法是将其托管在具有行或列定义的 Grid 控件中。

于 2012-02-07T21:13:40.450 回答