[英]WP8 ListBox not scrolling
我正在開發一個WP8應用程序,我有滾動問題。 在我的頁面中,我有一個網格和兩個列表框。 為什么在你看來? 我也試過使用ScrollViewer,但效果很好。
<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>
RowDefinition
上的Height="Auto"
沒有提供調用ScrollViewer
任何內容
它需要一個邊界來告訴它“嘿,你到達了允許顯示的地方的末端,任何進一步的,它將需要滾動。”
說得通?
要修復它,您可以將RowDefinition設置為“*”或固定高度,或者放在Row或ListBox上,或等效於建立邊界點。
希望這可以幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.