如何在 WP7 中显示当前页面中的所有列表选择器项目?
我在 ScrollViewer 内的列表框中使用列表选择器。如果列表选择器中的项目数为 3(或少于 3),则列表选择器将在当前页面中作为组合框打开。但如果项目数量超过 3,它将在另一个页面中打开,而不是作为 ComboBox。我该如何解决这个问题?
I use a Listpicker in a Listbox inside a ScrollViewer. If the number of items in the Listpicker is 3 (or less than 3), the Listpicker opens as a ComboBox in the current page. But if the number of items is more than 3, it opens in another page, not as a ComboBox. How can I solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以通过设置 ListPicker 的
ItemCountThreshold
属性来设置在其他页面上显示的项目数。例如。当有超过 3 个项目可供选择时,设置 ItemCountThreshold=3 将强制 ListPicker 在新页面上显示项目。有关 ListPicker 属性的更多信息可以找到,例如。此处:深入了解 WP7 的 ListPicker
You can set number of items that as displayed on an other page by setting
ItemCountThreshold
property of ListPicker. Eg. setting ItemCountThreshold=3 will force ListPicker to show items on new page when there are more then 3 items available to select.More info about ListPicker properties can be fount eg. here: ListPicker for WP7 in depth
ListPicker 是 Silverlight Toolkit for Windows Phone 中的一个新控件。它供用户选择其他项目,例如 Combobox,但 ListPicker 比 Combobox 具有更多功能。当您有大约 1->4 的小项目时,它会将数据显示为组合框,如果有更多项目,则列表选择器会将数据显示为列表框。
请参阅此链接 获得完美的想法。
ListPicker is a new control in the Silverlight Toolkit for Windows Phone. It is for user's to choose another item like Combobox but ListPicker has more features than a Combobox. When you have little item about 1->4 it'll show data as a Combobox and if more item Listpicker will show data as a ListBox.
Refer this Link to get perfect idea.
阅读这篇文章并且一定要付费注意“ItemCountThreshold”属性。
Read this article and certainly pay attention to the "ItemCountThreshold" property.
虽然工具包团队建议遵守该限制,但也有解决此问题的方法。可以通过代码也可以通过绑定来设置值。
请参阅我的详细相关问题的回答。
While the toolkit team advised to adhere to the restriction, there are workarounds for this issue. A value can be set via code and also via a binding.
See my detailed answer to a related question.