Treeview和列表视图控件

时间:2011-11-04 15:38:49

标签: c# winforms

我有以下示例xml文件

   <?xml version="1.0" encoding="utf-8" standalone="yes"?>

   <IResponse   xmlns:xsi="http://www.w3.org/2001/XMLScheminstance"                            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <Language>en</Language>
   <Code>Approved</Code>
   <Message> Approved</Message>
   <Info xsi:type="Info">
   <Number>11</Number>
   <ExpiryDate year="10" month="8" />
   <StartDate year="7" month="8" />
   <currency="GBP">36.00</currency>

  <ACode>096392</ACode>
  </IResponse>

如何在treeview控制中显示节点和子元素以及list view中的值?

     public void Deserialize()
    {
        XmlReader reader = XmlReader.Create(this.filePath);
        XmlSerializer serializer = new XmlSerializer(typeof(Response));
        if (serializer.CanDeserialize(reader))
        {
            Response obj = serializer.Deserialize(reader) as Response;

          // obj consists of xml file nodes and i want to display this in treeview
            // control and values in between them as list view .
        }
        else
        {
            iccTransactionResponseBindingSource.DataSource = null;
        }

    }

1 个答案:

答案 0 :(得分:2)

也许这个MS KB文件? http://support.microsoft.com/kb/317597