实现功能:WPF通过读取XML数据绑定到TreeView, 在通过TreeView选择项(Node)获取的对应的数据绑定到DataGrid控件上,再通过DataGrid选中行的详细信息数据绑定到另一个DataGrid。
首先创建XML数据. 名称为 Order.xml
<?xml version="1.0" encoding="utf-8" ?>
<root>
<category name="Computer">
<product name="联想笔记本">
<order orderId="1" orderName="cizon的订单" orderDate="2012-11-10">
<orderInfo productName="联想笔记本" unitPrice="3000" count="2">
</orderInfo>
</order>
<order orderId="2" orderName="steven的订单" orderDate="2012-11-10">
<orderInfo productName="联想笔记本" unitPrice="3000" count="2">
</orderInfo>
</order>
</product>
<product name="宏基笔记本">
<order orderId="1" orderName="Luly的订单" orderDate="2012-11-10">
<orderInfo productName="宏基笔记本" unitPrice="2000" count="3">
</orderInfo>
</order>
<order orderId="2" orderName="steven的订单" orderDate="2012-11-10">
<orderInfo productName="宏基笔记本" unitPrice="2000" count="3">
</orderInfo>
</order>
</product>
<product name="华硕笔记本"></product>
</category>
<category name="TV">
<product name="海尔电视">
<order orderId="1" orderName="cizon的订单" orderDate="2012-11-10">
<orderInfo productName="海尔电视" unitPrice="1000" count="2">
</orderInfo>
</order>
<order orderId="2" orderName="steven的订单"