0
嗨,我使用字典來填充我的TreeView ...如何使用字典
Dictionary<int, Dictionary<string, int>> management = new Dictionary<int, Dictionary<string, int>>();
現在管理具有以下值
ID Name Parent
1 Manager 0
2 Accountant 0
3 Assistant Manager 1
4 Branch Manager 1
5 Employee1 3
6 Employee3 3
7 Employee2 4
8 Accountant1 2
9 Accountant2 2
在後面DispalyTree(代碼)是填充樹狀該填充我的TreeView與詞典功能vaules ..我知道下面的代碼是不完整的..我只是成功的顯示管理器和會計師,我不知道如何來填充其子節點..
我曾嘗試了這麼多,但沒能做到..我堅持這個像1周..請幫助
public void DisplayTree()
{
TreeNode parentnode = new TreeNode();
TreeBL l_bltree = new TreeBL();
Dictionary<int, Dictionary<string, int>> manage = new Dictionary<int, Dictionary<string, int>>();
manage = l_bltree.ChildTree();
foreach (var kvp in manage)
{
var innerDict = kvp.Value;
foreach (var innerKvp in innerDict)
{
parentnode = new TreeNode(innerKvp.Key);
if (innerKvp.Value == 0)
{
treeview.Nodes.Add(parentnode);
}
}
}
}
什麼樹狀WPF,WinForms的? – markmnl
asp.net web應用程序 – user2380844