private void UpdateAttachmentNode_Click(object sender, RoutedEventArgs e) { if (tvAttachments.SelectedItem != null) { AttachmentNode selectedNode = (AttachmentNode)tvAttachments.SelectedItem; if (selectedNode.IsFile) { AttachmentNoteWindow dlg = new AttachmentNoteWindow(this) { Note = selectedNode.Attachment.Note }; if (dlg.ShowDialog() ?? false) { selectedNode.UpdateNote(dlg.Note); attachments.RemoveAll(x => x.Path == selectedNode.Attachment.Path); attachments.Add(new Attachment() { Path = selectedNode.Attachment.Path, Note = dlg.Note }); } } } }