Windows Phone ListBox无法滚动到底部
2014-01-28 11:21
417 查看
1.
ListBox无法滚动到底部,原因是Listbox它不知道自己有多高,所以需要添加以下代码。
<ListBox x:Name=”lstboxTasks” HorizontalContentAlignment=”Stretch” Height=”{Binding ElementName=LayoutRoot, Path=ActualHeight, Mode=OneWay}” ItemsSource=”{Binding
Tasks}” Grid.Row=”1″>
注意红色部分,将LayoutRoot的实际高度与之绑定,告诉Listbox你有多高
2.
The key to scrolling is the Height value of the ScrollViewer or ListBox (with its built-in ScrollViewer). The Height should be set to the desired viewport size on the screen. You can set Height to an explicit number, but you can have Silverlight set it to the
available height on the screen. Do this by putting the ScrollViewer or ListBox in a Grid row that has Height="*".
Row 0 of the grid has Height="Auto" which means its height will expand to the total height of its contents. Row 1 of the grid has Height="*" which means it will be set to the remaining available height on the screen.
More information about Grid row height: RowDefinition.Height
Property
ListBox无法滚动到底部,原因是Listbox它不知道自己有多高,所以需要添加以下代码。
<ListBox x:Name=”lstboxTasks” HorizontalContentAlignment=”Stretch” Height=”{Binding ElementName=LayoutRoot, Path=ActualHeight, Mode=OneWay}” ItemsSource=”{Binding
Tasks}” Grid.Row=”1″>
注意红色部分,将LayoutRoot的实际高度与之绑定,告诉Listbox你有多高
2.
The key to scrolling is the Height value of the ScrollViewer or ListBox (with its built-in ScrollViewer). The Height should be set to the desired viewport size on the screen. You can set Height to an explicit number, but you can have Silverlight set it to the
available height on the screen. Do this by putting the ScrollViewer or ListBox in a Grid row that has Height="*".
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> |
<Grid.RowDefinitions> |
<RowDefinition Height="Auto"/> |
<RowDefinition Height="*"/> |
</Grid.RowDefinitions> |
<TextBox Grid.Row="0" Height="72" HorizontalAlignment="Left" Margin="0" Name="filter" Text="search" VerticalAlignment="Top" Width="458" LostFocus="filter_LostFocus" GotFocus="filter_GotFocus" Foreground="Gray" TextChanged="filter_TextChanged" /> |
<ListBox Grid.Row="1" HorizontalAlignment="Left" Margin="0,12,0,0" Name="people" VerticalAlignment="Top"> |
<ListBox.ItemTemplate> |
<DataTemplate> |
<TextBlock Text="{Binding BuiltName}" Style="{StaticResource PhoneTextLargeStyle}"/> |
</DataTemplate> |
</ListBox.ItemTemplate> |
</ListBox> |
</Grid> |
More information about Grid row height: RowDefinition.Height
Property
相关文章推荐
- wp7开发中ListBox无法滚动到底部
- Windows Phone ListBox 水平滚动的代码
- ScrollView无法完全滚动到底部解决方法
- 如何解决IONIC页面底部被遮住无法向上滚动问题
- windows phone listbox的点击事件
- Windows Phone Developer Registration 开发人员无法连接注册解决
- 让ListBox自动滚动到底部
- Windows Phone ListBox的分页加载
- VS2010 C# ListBox 自动滚动到底部
- ios 内层滚动到顶部或者底部无法滑动问题
- ScrollViewer的滚动问题(ScrollViewer里添加stackPanel,再加俩个listbox无法滚动的问题)
- C#中listBox实现自动滚动到底部的效果
- win8.1使用WP8SDK出现Windows Phone Emulator无法启动的问题解决方案
- windows phone listbox的点击事件
- windows phone grid无法响应事件的问题
- win8.1使用WP8SDK出现Windows Phone Emulator无法启动的问题解决方案
- windows phone listbox的点击事件
- WP7判断ListBox依据滚动至底部
- Windows Phone Listbox虚拟化的问题
- windows phone listbox的点击事件