【IT168技术文档】
XDocument xdoc = XDocument.Load(file);
//列出所有数据绑定
var bindings = from b in xdoc.Descendants(XName.Get("STBinding", "http://www.agree.cn/superteller"))
select new { BindingPath=b.Attribute("Path").Value,Property=b.Parent.Name,CtrlType=b.Parent.Parent.Name};
foreach (var b in bindings)
{
Console.Out.WriteLine(b.CtrlType+"="+b.Property+"="+b.BindingPath);
}
//列出所有控件
var ctrls = from ctrl in xdoc.Descendants()
where ctrl.Attribute("Name") != null
select ctrl.Attribute("Name").Value;
foreach (var ctrl in ctrls)
{
Console.Out.WriteLine(ctrl);
}