0
votes

I am working with a ListPicker for Windows Phone. The goal is to make the list open up in full mode. Right now, the application crashes whenever the ListPicker is selected:

<toolkit:ListPicker Name="list" SelectionChanged="moduleList_SelectionChanged"  Tap="moduleList_Tap">
    <toolkit:ListPickerItem Name="item1" Content="Item 1"/>
    <toolkit:ListPickerItem Name="item2" Content="Item 2"/>
    <toolkit:ListPickerItem Name="item3" Content="Item 3"/>
    <toolkit:ListPickerItem Name="item4" Content="Item 4"/>
    <toolkit:ListPickerItem Name="item5" Content="Item 5"/>
    <toolkit:ListPickerItem Name="item6" Content="Item 6"/>
</toolkit:ListPicker>

I know that binding a list is one possible solution, but it appears that doing that breaks the enable/disableInList functions and makes a lot of code very messy. Is there another way to make this work?

1
What is the Exception that is thrown? What does your Tap code look like? - Oren
can u show us the code of bind your listPicker ? - Ashok Damani

1 Answers

2
votes

As you can read here (ListPicker crashes on full screen - Silverlight tool kit for WP7) the ListPicker does not work with ListPickerItem in FullMode.

However the answer in that link is not 100% correct. You can use the FullMode without DataBinding by using other Item types. If you only want a selection of some strings you can use this:

Add the namespace:

xmlns:corelib="clr-namespace:System;assembly=mscorlib"

and than your ListPicker:

<toolkit:ListPicker Name="list">
    <corelib:String>Item 1</corelib:String>
    <corelib:String>Item 2</corelib:String>
    <corelib:String>Item 3</corelib:String>
    <corelib:String>Item 4</corelib:String>
    <corelib:String>Item 5</corelib:String>
    <corelib:String>Item 6</corelib:String>
</toolkit:ListPicker>

You will have to style the FullMode yourself or you only get a List of string with a very small fontsize.

Or as it is answered here, you can add your Items via code behind and it should work.