I can't find a way to get and show the content of the current selected item, here is the XAML:
<toolkit:ListPicker Name="lp" Header="Network" SelectionChanged="selectionChanged">
<toolkit:ListPickerItem Content="aaa" />
<toolkit:ListPickerItem Content="bbb" />
</toolkit:ListPicker>
and the rest of the code:
private void selectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
if (e.RemovedItems != null && e.RemovedItems.Count > 0)
{
if (this.lp.SelectedItem != null)
{
var selectedItem = (sender as ListPicker).SelectedItem;
int selindex = lp.SelectedIndex; //just for testing
MessageBox.Show(selindex.ToString()); //just for testing
string text = (lp.SelectedItem as ListBoxItem).Content.ToString();
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
It gives me this exception at "string text..." line:
Object reference not set to an instance of an object