based on my research SelectedIndex property of listbox is not bindable, when you use the get accessor for the SelectedIndex property, it always returns -1. An attempt to use the set accessor for the SelectedIndex property raises a NotSupportedException. -- MSDN List selectedporperty
I also updated my code since my first code is wrong that creates new listbox and that results to empty/null. Also selectionchanged event does not have a problem to be used as event.
public void method (SelectionChangedEventArgs e)
{
{
if (e.AddedItems.Count == 1)
{
var listBoxItem = (ListBoxItem)e.AddedItems[0];
string _string1 = "Test";
if ((string)listBoxItem.Content == _string1)
{
navigationService.NavigateTo(new Uri(ViewModelLocator.page1, UriKind.Relative));
}
}
}
}
Thats it. Hope it helps! :)