All that i'm trying to do is to compare, for each value in a listbox, its value with a chosen one and then set the match index as selected. For some reason the exception in the title is raised. I don't understand why though. Code:
foreach(SurfaceListBoxItem n in BackgroundsList.Items)
{
if (n.ToString() == current) BackgroundsList.SelectedItem = n;
}
Thanks!