public void removeItem(object sender, RoutedEventArgs e) { ObservableCollection <TodoListEntry> itemsToRemove = new ObservableCollection <TodoListEntry>(); foreach (TodoListEntry item in lb_titles.SelectedItems) { itemsToRemove.Add(item); } foreach (TodoListEntry item in itemsToRemove) { ((ObservableCollection <TodoListEntry>)lb_titles.ItemsSource).Remove(item); } saveXML save = new saveXML(); save.XMLSave(); }
private void Submit(object sender, RoutedEventArgs e) { var _title = tb_Title.Text; var _date = dp_Date.ToString(); var _note = tb_Note.Text; MainWindowDataContext.contentList.Add(new TodoListEntry { title = _title.Trim(), date = _date.Trim(), note = _note.Trim() }); saveXML save = new saveXML(); save.XMLSave(); this.Close(); }