3
votes

I am trying to allow the listpicker dropdown to go to a full screen mode. When i enter the expansion mode to fullscreen only it will crash with the first chance expection. Below is my code:

C#:

monthCat.SetValue(Microsoft.Phone.Controls.ListPicker.ItemCountThresholdProperty,12);

XAML:

<toolkit:ListPicker Name="monthCat" ExpansionMode="FullScreenOnly">
    <toolkit:ListPickerItem Content="January" />
    <toolkit:ListPickerItem Content="February" />
    <toolkit:ListPickerItem Content="March" />
    <toolkit:ListPickerItem Content="April" />
    <toolkit:ListPickerItem Content="May" />
    <toolkit:ListPickerItem Content="June" />
    <toolkit:ListPickerItem Content="July" />
    <toolkit:ListPickerItem Content="August" />
    <toolkit:ListPickerItem Content="September" />
    <toolkit:ListPickerItem Content="October" />
    <toolkit:ListPickerItem Content="November" />
    <toolkit:ListPickerItem Content="December" />
</toolkit:ListPicker>

When I removed the ExpensionMode, it works fine but it is not on the fullscreenmode.

1
Is ListPicker inside scrollviewr ???Jaihind
I have fixed it with my answer below.Gene Lim

1 Answers

3
votes

Try this:

 public MainPage()
        {
            InitializeComponent();

            SetBinding();

        }

        void SetBinding()
        {
            List<string> list = new List<string>();
            list.Add("January");
            list.Add("February");
            list.Add("March");
            list.Add("April");
            list.Add("May");
            list.Add("June");
            list.Add("July");
            list.Add("August");
            list.Add("September");
            list.Add("October");
            list.Add("November");
            list.Add("December");
            monthCat.ItemsSource = list;
        }

and paste this code in your .xaml file.

 <toolkit:ListPicker Name="monthCat" ExpansionMode="FullScreenOnly" >
                <toolkit:ListPicker.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}"/>
                    </DataTemplate>
                </toolkit:ListPicker.ItemTemplate>
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="25"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>