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
the following code does not do its job
do you get an exception? – PoweredByOrangeSelectedItem
's type when SelectionChanged is called? – PoweredByOrangeif (Backgroundlist.SelectedItem.Equals("photo"))
. Then hover your mouse overSelectedItem
and tell me what it says. – PoweredByOrangeSelectedValue
property? – PoweredByOrange