ListPicker always crashes when ExpansionMode is set to FullScreenOnly
-
06-02-2021 - |
Question
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 ?
Solution
Adding "item1" many times might create problem? try changing content to item1, item2...etc
If not so, try using listPicker1.Items.Add();
OTHER TIPS
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.
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#.