【问题标题】:Windows phone toolkit ListPicker only allowing 5 elementsWindows phone 工具包 ListPicker 只允许 5 个元素
【发布时间】:2013-11-22 22:58:35
【问题描述】:

我有一个简单的工作示例:

   <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <toolkit:ListPicker>
            <toolkit:ListPickerItem Content="FIRST" />
            <toolkit:ListPickerItem Content="SECOND" />
            <toolkit:ListPickerItem Content="THIRD" />
            <toolkit:ListPickerItem Content="FOURTH" />
            <toolkit:ListPickerItem Content="FIFTH" />
            <toolkit:ListPickerItem Content="SIXTH" />
        </toolkit:ListPicker>
    </Grid>

创建一个新的 windows phone 8 应用程序,安装 windows phone 工具包 nuget 包,然后只添加如上所示的 listpicker。它会吹。但是,如果你删除了第六个 ListPickerItem,那么它就可以工作了。

还有其他人让列表选择器工作吗?我是否需要在代码中添加项目才能使其正常工作?

【问题讨论】:

  • 我相信你需要添加一个ItemTemplate/FullModeItemTemplate。

标签: xaml windows-phone-8 silverlight-toolkit


【解决方案1】:

默认情况下,列表选择器只允许 5 个元素在同一个视图上显示,如果超过它会显示它将需要一个完整的单个视图来显示元素,为此您必须从后面的代码中添加元素。或者您可以更改 ItemCountThreshold。

【讨论】:

    【解决方案2】:

    来自 souvickcse 的答案不再起作用,因为 ItemCountThreshold 现在是只读的。这是一个可行的“hack”。将“ListPicker”替换为您为列表选择器指定的名称。

    ListPicker.SetValue(Microsoft.Phone.Controls.ListPicker.ItemCountThresholdProperty, 100);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多