Click here to Skip to main content
15,847,077 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello there!

I've been programming for 6 months now - so please don't tear me apart! :(

I am all new to Silverlight and WPF and tried to code a little Windows Phone 7 application. After a while I found out that there is no real "date picker" or even a "list picker" control. So I searched for it and found out that these controls are implemented in the "Silverlight for Windows Phone Toolkit"... The name of the control is "ListPicker" and "ListPickerItem". Both are organised in the namespace "toolkit".
Both of them really worked great. Until I filled the List Control with more than 5 elements. After filling a sixth element into the control the application instantly crashed.

The XAML (Content Panel) code is:

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="8,0,16,0">
        <RowDefinition Height="Auto" MinHeight="77"/>
        <RowDefinition Height="96"/>
        <RowDefinition Height="80"/>
        <RowDefinition Height="354"/>
        <ColumnDefinition Width="0.158*"/>
        <ColumnDefinition Width="0.842*"/>
    <TextBlock TextWrapping="Wrap" Text="Tag" FontSize="26.667" Margin="0,0,0,12"/>
    <toolkit:TimePicker Header="Uhrzeit" Value="9/16/2010" Grid.Column="1" Margin="0,0,8,0" HorizontalAlignment="Right" Width="137" Height="95" VerticalAlignment="Top" Grid.Row="1"/>
    <toolkit:ListPicker Grid.Column="1" Margin="0,0,20,0">
        <toolkit:ListPickerItem Content="Montag" Height="50"/>
        <toolkit:ListPickerItem Content="Dienstag" Height="50"/>
        <toolkit:ListPickerItem Content="Mittwoch" Height="50"/>
        <toolkit:ListPickerItem Content="Donnerstag" Height="50"/>
        <toolkit:ListPickerItem Content="Freitag" Height="50"/>
        <toolkit:ListPickerItem Content="Samstag" Height="50"/>
        <toolkit:ListPickerItem Content="Sonntag" Height="50"/>

If I jump to the screen where I placed the mentioned control, the following error appears:

[Line: 0 Position: 0]
   --- Inner Exception ---
The parameter is incorrect.

It's a "System.Windows.Markup.XamlParseException"...
Is there the possibility that this elements can only contain up to five elements?

Thank you very much and please forgive my poor English :(

It does appear that the List Picker is limited to 5 items. According to Alex Yakhnin's blog[^] he answer's why by saying: "If it's more than five you should switch to using listbox type of control."
Share this answer
Oh my goodness - am I really that stupid.
After searching for "ListPicker with more than 5 items" I found out that ItemCountThreshold e.g. 'ItemCountThreshold="10"' solves the problem!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900