C# 如何用列表填充树视图<;字符串>;?
嗨,我有个问题要问treeview 我有一个列表列表和一个名为treeLic的树视图。现在我想用这个列表填充这个树视图。我能这样做吗?怎么做C# 如何用列表填充树视图<;字符串>;?,c#,string,list,collections,treeview,C#,String,List,Collections,Treeview,嗨,我有个问题要问treeview 我有一个列表列表和一个名为treeLic的树视图。现在我想用这个列表填充这个树视图。我能这样做吗?怎么做 XmlReader xr = XmlReader.Create(new StringReader(final_output)); while (xr.Read()) { switch (xr.Name) { cas
XmlReader xr = XmlReader.Create(new StringReader(final_output));
while (xr.Read())
{
switch (xr.Name)
{
case "FEATURE":
if (xr.HasAttributes)
{
while (xr.MoveToNextAttribute())
{
if (xr.Name == "NAME")
{
liste.Add(xr.Value);
}
}
}
break;
}
}
treeLic. ????? //fill this treeview with this list liste
试试这个
XmlReader xr = XmlReader.Create(new StringReader(final_output));
while (xr.Read())
{
switch (xr.Name)
{
case "FEATURE":
TreeNode root = MyTreeView.Nodes.Add("FEATURE");
if (xr.HasAttributes)
{
while (xr.MoveToNextAttribute())
{
if (xr.Name == "NAME")
{
TreeNode workingNode = root.Nodes.Add(xr.Value.ToString());
liste.Add(xr.Value);
}
}
}
break;
}
}
展示你的作品,告诉人们你到目前为止都做了些什么。人们看不懂你的心思..可能是
XmlReader xr = XmlReader.Create(new StringReader(final_output));
while (xr.Read())
{
switch (xr.Name)
{
case "FEATURE":
TreeNode root = MyTreeView.Nodes.Add("FEATURE");
if (xr.HasAttributes)
{
while (xr.MoveToNextAttribute())
{
if (xr.Name == "NAME")
{
TreeNode workingNode = root.Nodes.Add(xr.Value.ToString());
liste.Add(xr.Value);
}
}
}
break;
}
}