/// <summary> /// 初始化目录 /// </summary> private void InitDirectionary() { Dictionary <string, List <BTreeView> > mainTree = new Dictionary <string, List <BTreeView> >(); foreach (var tableData in allExcelDataConfigs) { if (!mainTree.TryGetValue(tableData.configAlias, out List <BTreeView> value)) { value = new List <BTreeView>(); mainTree[tableData.configAlias] = value; } value.Add(new BTreeView(tableData.itemDir)); } var itemList = new List <BTreeView>(); foreach (var it in mainTree) { var item = new BTreeView(new ExcelDataItem(null, 0, it.Key)); foreach (var table in it.Value) { item.AddTable(table); } itemList.Add(item); } foreach (var it in itemList) { it.Init(); } Mulu.Items.Clear(); Mulu.Visibility = Visibility.Visible; Mulu.ItemsSource = itemList; }
private List <BTreeView> GetTestList() { int fontSize = 15; var itemList = new List <BTreeView>(); for (int i = 0; i < 50; ++i) { var titem = new BTreeView() { Header = "item" + i, IsExpanded = false, Visibility = Visibility.Visible, FontSize = fontSize }; var son = new BTreeView() { Header = "item_sonsssssssssssssssssssssssssssssssssssss" + i, IsExpanded = false, FontSize = fontSize }; var son_son = new BTreeView() { Header = "xx_item_sonsssssssssssssssssssssssssssssssssssss" + i, IsExpanded = false, FontSize = fontSize }; son_son.Selected += tabCtrl.OnMuluItemSelected; son.Items.Add(son_son); titem.Items.Add(son); itemList.Add(titem); } return(itemList); }
public void AddTable(BTreeView data) { this.Items.Add(data); this.itemList.Add(data); //this.itemList.Add(data); //this.ItemsSource = itemList; }
public void AddSearchResult(List <ExcelDataItem> retList) { if (retList.Count <= 0) { win.ShowMessageBox("未找到相关的文件"); return; } var tree = new BTreeView(new ExcelDataItem(null, 0, "搜索_" + (++count))); foreach (var it in retList) { tree.AddTable(new BTreeView(it)); } tree.Init(); tree.IsExpanded = true; searchList.Add(tree); win.SearchMulu.Items.Add(tree); win.SearchMulu.Visibility = Visibility.Visible; }
public void Init() { if (data.items != null) { foreach (var it in data.items) { var temp = new BTreeView(it.Value); this.itemList.Add(temp); this.Items.Add(temp); } } foreach (var it in this.itemList) { it.Init(); } if (data.config != null && data.id > 0) { this.Selected += MainWindow.tabCtrl.OnMuluItemSelected; } }