Question

I am using a ListPicker and it is always showing in FullscreenOnly mode even if i change the ExpansionMode to ExpansionAllowed.

But in other page the same code is working properly.

Why is this strange behaviour happening?

Was it helpful?

Solution

(Assuming this is the Windows Phone Toolkit ListPicker)

If your list is longer than 5 items then it will open in FullScreenMode. It isn't possible to change this threshold value.

So, this one will expand:

<toolkit:ListPicker Header="Background">
    <sys:String>dark</sys:String>
    <sys:String>light</sys:String>
    <sys:String>dazzle</sys:String>
    <sys:String>4</sys:String>
    <sys:String>5</sys:String>
</toolkit:ListPicker>

This one will always be full screen:

<toolkit:ListPicker Header="Background">
    <sys:String>dark</sys:String>
    <sys:String>light</sys:String>
    <sys:String>dazzle</sys:String>
    <sys:String>4</sys:String>
    <sys:String>5</sys:String>
    <sys:String>6</sys:String>
</toolkit:ListPicker>

OTHER TIPS

It is possible to expand more then 5 elements. You must set ItemCountThreshold.

I set it in view model in method where I set collection's items.

Collection = new ObservableCollection<Item>
{
    new Item();
    new Item();
    new Item();
    new Item();
    new Item();
    new Item();
}
CollectionItemsCount = Collection.Count;

And binding in xaml:

<toolkit:ListPicker ExpansionMode="ExpansionAllowed" ItemsSource="{Binding Collection}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" ItemCountThreshold="{Binding CollectionItemsCount}">
(...)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top