【发布时间】:2016-04-05 21:23:31
【问题描述】:
所以我用 C# 编写了一个 WPF 程序,它从 .xml 文件中读取所有配置。
我想为用户提供一个基本界面,以便在 .xml 文件中编辑现有节点以及添加新节点。
我的 xml 文件示例:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Configurations>
<Documents>
<MenuChoice>Drawing</MenuChoice>
<Body>A drawing</Body>
<Cost>0</Cost>
</Documents>
<Documents>
<MenuChoice>Diagram</MenuChoice>
<Body>A diagram</Body>
<Cost>0</Cost>
</Documents>
<SystemSpecs>
<MenuChoice>spec1</MenuChoice>
<Body>spec1 body</Body>
<Cost>0</Cost>
</SystemSpecs>
<SystemSpecs>
<MenuChoice>spec2</MenuChoice>
<Body>spec2 body</Body>
<Cost>0</Cost>
</SystemSpecs>
</Configurations>
我尝试了不同的方法,例如将 DataGrid 绑定到 xml。
有没有一种简单的方法可以加载一组特定的节点,例如 <Documents> 节点,允许用户对其进行编辑或添加,然后保存?
【问题讨论】:
-
你用谷歌搜索过“WCF XML LINQ DataGridView”吗?有数百个结果!
标签: c# xml wpf wpfdatagrid