I'm trying to use the ListPicker
controller with ListPickerMode="Full"
, to get the fullscreen pick window. However it just generate an error when i try
"A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.dll
Additional information: Set property Microsoft.Phone.Controls.ListPicker.ListPickerMode
threw an exception. [Line: 49 Position: 57]"
Here's my code:
<toolkit:ListPicker x:Name="OutputSelector" ListPickerMode="Full"
Margin="0,542,6,0" Header="Output Type" Width="450" VerticalAlignment="Top" />
I populate my ListPicker in C# using a list to set as ItemSource if that is any help. Another thing is that when i try to write "ListPickerMode" in xml it doest give it as an option, but when i have written the whole thing it suggest "Full" "expanded" and "Normal".
If i add 5 items to the ListPicker it automatically uses FullMode, and i have tried changing ItemCountThreshold="0" but that just generate more errors.
I'm using Windowns Phone 7.1 OS 2011 aug release.
It's probably just me that is stupid, first day with Windows Phone programing :)
UPDATE!
Well it looks like ItemCountThreshold & ListPickerMode was remove for 7.1 or something, atleast in XAML part, not the C# part, where they are read only.
Solution for my problem!
<toolkit:ListPicker x:Name="OutputSelector" ExpansionMode="FullScreenOnly"
Margin="0,542,6,0" Header="Output Type" Width="450" VerticalAlignment="Top" />
The ExpansionMode will make the Listpicker appear in fullscreen or expanded.
As stated in the issue tracker of the silverlight toolkit [1], ItemCountThreshold should not be set (and cannot be set using simple xaml).
However, there are two workarounds for this issue. If you you don't mind to use codebehind, set the property via SetValue:
//e.g., in the constructor, just after InitializeComponent();
ListPicker.SetValue(Microsoft.Phone.Controls.ListPicker.ItemCountThresholdProperty, 0);
To set the value in xaml, you can use a binding:
<toolkit:ListPicker ItemCountThreshold="{Binding Hugo,FallbackValue=0}">(...)
In this example, I use a bogus binding expression and set the value using FallbackValue. Of course, an actual working binding should work as well. The xaml approach was only tested on the WP8 SDK, however it should work on 7.1 as well.
Edit: Just found out that the xaml approach breaks the designer.
[1] http://silverlight.codeplex.com/workitem/9742
The solution proposed by the author (moving here for better visibility):
Well it looks like ItemCountThreshold & ListPickerMode was remove for 7.1 or something, atleast in XAML part, not the C# part, where they are read only.
Solution for my problem!
<toolkit:ListPicker x:Name="OutputSelector" ExpansionMode="FullScreenOnly" Margin="0,542,6,0" Header="Output Type" Width="450" VerticalAlignment="Top" />
The ExpansionMode will make the Listpicker appear in fullscreen or expanded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With