سؤال

I have a simple working example:

   <!--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>

create a new windows phone 8 app, install the windows phone toolkit nuget package, then add only the listpicker as shown above. It will blow. But, if you delete the sixth ListPickerItem, then it works.

Has anyone else gotten the listpicker to work? Do I need to add the items in code to get this to work?

هل كانت مفيدة؟

المحلول

by default list picker only allow 5 elements to show on the same view if it is more than that it will show it will take a full single view to show the elements and for that you have to add the elements from code behind. or you can change ItemCountThreshold.

نصائح أخرى

The answer from souvickcse is not working anymore, because ItemCountThreshold is read-only now. Here's a "hack" which will work. Replace "ListPicker" with the Name you have given to your listpicker.

ListPicker.SetValue(Microsoft.Phone.Controls.ListPicker.ItemCountThresholdProperty, 100);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top