如何在 WP7 中显示当前页面中的所有列表选择器项目?

发布于 2025-01-08 14:08:55 字数 131 浏览 0 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

向地狱狂奔 2025-01-15 14:08:55

您可以通过设置 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

允世 2025-01-15 14:08:55

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.

聽兲甴掵 2025-01-15 14:08:55

阅读这篇文章并且一定要付费注意“ItemCountThreshold”属性。

ItemCountThreshold 是 int 类型的依赖属性。它指定在扩展模式下显示的最大项目数。默认情况下,包含五个或更少项目的列表会就地展开,而包含更多项目的列表会切换到全屏选择界面。也可以设置为 0 以切换 Full 模式,或者设置为非常大的数字以切换 Expanded 模式。

Read this article and certainly pay attention to the "ItemCountThreshold" property.

ItemCountThreshold is a dependency property of type int. It specifies the maximum number of items that will be displayed in Expanded mode. By default, lists with five or fewer items expand in-place while lists with more items switch to a full-screen selection interface. It can also be set to 0 to switch Full mode or a very large number to switch Expanded mode.

醉南桥 2025-01-15 14:08:55

虽然工具包团队建议遵守该限制,但也有解决此问题的方法。可以通过代码也可以通过绑定来设置值。

<toolkit:ListPicker ItemCountThreshold="{Binding Hugo,FallbackValue=10}">(...)
<!-- Hugo is a bogus binding that does not really exist -->

请参阅我的详细相关问题的回答

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.

<toolkit:ListPicker ItemCountThreshold="{Binding Hugo,FallbackValue=10}">(...)
<!-- Hugo is a bogus binding that does not really exist -->

See my detailed answer to a related question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文