Good day, everybody. I have the following problem:
I have a listpicker with the x:Name="Backgroundlist" declared in XAML and it works fine.
Its items are declared as follows:
public MainPage()
{
InitializeComponent();
Backgroundlist.Items.Add("photo");
Backgroundlist.Items.Add("Bing");
}
However, the following code does not do its job (i.e. it doesn't show the MessageBox):
private void Backgroundlist_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (Backgroundlist.SelectedItem.Equals("photo"))
{
MessageBox.Show("photo");
}
if (Backgroundlist.SelectedItem.Equals("Bing"))
{
MessageBox.Show("Bing");
}
}
What seems to be the problem? Thanks!
P.S. I do not get an exception
Ok. So here's the deal. As well I had to declare a
SelectionChanged="Picker"
in XAML. Here's the full code that works:Everything turned out to be very primitive in the end)