I have a page in a Windows Phone 8 app where the user can link items to a group (n:1). The group is selected via the Toolkit ListPicker control. Under the ListPicker is a unlink button for removing the link from item to group.
<StackPanel x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<toolkit:ListPicker x:Name="GorupList"
Header="Background"
ExpansionMode="FullscreenOnly"
ItemsSource="{Binding}"
SelectionChanged="GroupList_SelectionChanged">
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="16 21 0 20">
<TextBlock Text="{Binding Name}"
FontSize="43"
FontFamily="{StaticResource PhoneFontFamilyLight}"/>
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
<Button x:Name="UnlinkButton" Content="Unlink" Click="OnUnlink" />
</StackPanel>
If the usere unlinks a item from a group, I want to set the SelectedItem of the ListPicker to null (no group selected). Just setting SelectedItem to null or SelectedIndex to -1 does not work (Exception: set valid value...).
Does anybody have an idea for this issue?
//EDIT: I'm looking for a workaround, not compiling a my own ListPicker control.