标签:des style c class blog code
cmb_State_Send.ItemsSource = null; XmlDocument doc = new XmlDocument(); doc.Load("D:\\模板\\WorkstationState_Config.xml"); //加载Xml文件 XmlElement rootElem = doc.DocumentElement; //获取根节点 XmlNode xn = rootElem.SelectSingleNode("//Workstation[@Name=‘" + str + "‘]"); if (xn != null) { XmlNodeList xn1 = xn.ChildNodes; List<string> tem = new List<string>(); for (int i = 0; i < xn1.Count; i++) { tem.Add(xn1.Item(i).InnerText); } if (tem.Count > 0) { cmb_State_Send.ItemsSource = tem; cmb_State_Send.SelectedIndex = 0; } }
读取XML文件的指定节点的值 并转换为Item,布布扣,bubuko.com
标签:des style c class blog code
原文地址:http://www.cnblogs.com/fengyie55/p/3755279.html