可能重复:
仅显示数据网格中的根节点
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataGrid1.DataMember = "";
this.dataGrid1.Location = new System.Drawing.Point(36, 50);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(464, 432);
this.dataGrid1.TabIndex = 0;
//
this.AutoScaleBaseSize = new System.Drawing.Size(35, 13);
this.ClientSize = new System.Drawing.Size(592, 573);
this.Controls.AddRange(new System.Windows.Forms.Control[] { this.dataGrid1 });
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);
XmlDataDocument xmlDatadoc = new XmlDataDocument();
xmlDatadoc.DataSet.ReadXml("abcd.xml");
DataSet ds = new DataSet("abc");
ds = xmlDatadoc.DataSet;
dataGrid1.DataSource = ds.Tables[0];
上面的代码读取 XML 文件并显示在 DataGrid 中。有人可以告诉我如何编辑 DataGrid 以便可以编辑 XML 中的相应值吗?