当 ExpansionMode 设置为 FullScreenOnly 时,ListPicker 总是崩溃
我应该如何让我的列表选择器以全屏模式打开?当我将 ExpansionMode 设置为 FullScreenOnly 时,它会崩溃。我尝试创建空白项目并执行相同的操作,但它也崩溃了。
<toolkit:ListPicker Height="100" HorizontalAlignment="Left" Margin="53,37,0,0" Name="listPicker1" VerticalAlignment="Top" Width="200" ExpansionMode="FullScreenOnly">
<toolkit:ListPickerItem Content="item1"/>
<toolkit:ListPickerItem Content="item1"/>
<toolkit:ListPickerItem Content="item1"/>
<toolkit:ListPickerItem Content="item1"/>
<toolkit:ListPickerItem Content="item1"/>
<toolkit:ListPickerItem Content="item1"/>
</toolkit:ListPicker>
我应该如何解决这个问题?
How should I make my list picker open in full screen mode? When I set ExpansionMode to FullScreenOnly it crashes. I tried creating blank project and doing the same but it also crashes.
<toolkit:ListPicker Height="100" HorizontalAlignment="Left" Margin="53,37,0,0" Name="listPicker1" VerticalAlignment="Top" Width="200" ExpansionMode="FullScreenOnly">
<toolkit:ListPickerItem Content="item1"/>
<toolkit:ListPickerItem Content="item1"/>
<toolkit:ListPickerItem Content="item1"/>
<toolkit:ListPickerItem Content="item1"/>
<toolkit:ListPickerItem Content="item1"/>
<toolkit:ListPickerItem Content="item1"/>
</toolkit:ListPicker>
How should I work around this problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一个[显然已知] 的错误,当在 XAML 中定义项目时,完整模式会导致错误。
正如另一个答案所说,在代码中定义您的项目,就不会出现此问题。
There is a[n apparently known] bug where full mode causes an error when the items are defined in XAML.
As the other answer says, define your items in code and this issue is not seen.
多次添加“item1”可能会产生问题?尝试将内容更改为 item1、item2...等
如果不是这样,请尝试使用 listPicker1.Items.Add();
Adding "item1" many times might create problem? try changing content to item1, item2...etc
If not so, try using listPicker1.Items.Add();
问题是 ListPicker 中的一些错误导致它无法显示超过 5 个项目(如果直接从 XAML 提供这些项目)。更好地使用数据绑定并通过 C# 生成项目。
The problem is some bug in ListPicker that prevents it to display more than 5 items if they are directly provided from the XAML. Better use data binding and generate items via C#.