[英]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.