private void AddButton_Click(object sender, RoutedEventArgs e) { var textDialog = new TextEditDialog("Create new Tag:", Tags); if (textDialog.ShowDialog() == true) { if (Tags == null) { Tags = new List <string>(); } Tags.Add(textDialog.Text); TagsListBox.Items.Add(textDialog.Text); } }
private void EditButton_Click(object sender, RoutedEventArgs e) { if (_selectedTag == null) { return; } var textDialog = new TextEditDialog("Edit Tag:", Tags, _selectedTag); if (textDialog.ShowDialog() == true) { Tags.Remove(_selectedTag); TagsListBox.Items.Remove(_selectedTag); Tags.Add(textDialog.Text); TagsListBox.Items.Add(textDialog.Text); } }