您好我想了解为什么我的列表视图删除(patcherButton4)不起作用。我只是不想当用户在列表中选择一个项目然后他单击删除按钮时,xml 记录被删除。:\
private void patcherButton4_Click(object sender, EventArgs e)
{
XDocument munchercrawler = XDocument.Load(@"C:\Users\Admin\Desktop\Entretelp\InfoList.xml");
listView1.SelectedItems.Clear();
munchercrawler.Root.Elements("Name").
FirstOrDefault(item => item.Element("Name").Value == listView1.SelectedItems[0].SubItems[0].Text)
.Remove();
munchercrawler.Save(@"C:\Users\Admin\Desktop\Entretelp\InfoList.xml");
listView1.SelectedItems.Clear();
}
谢谢!