private void SeasonSelector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox cb = (ComboBox)sender; int ind = cb.SelectedIndex; if (ind < 0) { return; } var seasontext = ((TextBlock)cb.Items[ind]).Text; int sn = Int32.Parse(seasontext.Replace("Season ", "")); Dictionary <int, string> episodes = DatabaseStorage.GetEpisodesForSeason(CurrentClickedShow, sn); }