private async void AddTopic_Click(object sender, RoutedEventArgs e) { if (check() == 1 || check() == 2) { return; } selectedClass.addTopic(topicBox.Text, mainTextBox.Text); saveFile(); topicBox.Text = ""; mainTextBox.Text = ""; List <string> topics = selectedClass.Topics; topicsList.Items.Clear(); foreach (string topic in topics) { ComboBoxItem topicDispaly = new ComboBoxItem(); topicDispaly.Content = topic; topicsList.Items.Add(topicDispaly); } }