/// <summary> /// Generate TreeViewItem /// </summary> /// <param name="localizeItemSelector"></param> /// <param name="item"></param> private void SetNavGroupSubItem(LocalizeItemSelector localizeItemSelector, SystemMenuTreeList item) { SubItem = new TreeViewItemEx(); SubItem.Header = localizeItemSelector.setLocalizeValue(SubItem, TreeViewItemEx.HeaderProperty); SubItem.Style = objtemplate; _dicflattenedTree.Add(item.Id, SubItem); SubItem.IsExpanded = true; if (_dicflattenedTree.ContainsKey(item.PId)) { //// SubItem.ContextMenu = menuAdd; _dicflattenedTree[item.PId].Items.Add(SubItem); } else { objtree.Items.Add(SubItem); } var Col = StructureItemsSource.OrderBy(a => a.DisplayIndex).Where(p => p.PId == item.Id); if (0 < Col.Count()) { GenerateNavControlTreeStructure(Col); } else { SubItem.PageUri = item.PageUri; if (!string.IsNullOrEmpty(item.NameClass)) { SubItem.MouseEnter += new MouseEventHandler(SubItem_MouseEnter); SubItem.MouseLeftButtonUp += new MouseButtonEventHandler(newItem_MouseLeftButtonUp); SubItem.PreviewKeyDown += new KeyEventHandler(subItemnew_PreviewKeyDown); } } }
public void GenerateNavControlTreeStructure(IEnumerable <SystemMenuTreeList> table) { LocalizeItemSelector localizeItemSelector; foreach (var item in table) { localizeItemSelector = new LocalizeItemSelector(); CommonMethods.AddLocalizeItem(localizeItemSelector, "ja", item.NameJa != null ? item.NameJa : "PropertyValueNotSet"); CommonMethods.AddLocalizeItem(localizeItemSelector, "en", item.NameEn != null ? item.NameEn : "PropertyValueNotSet"); CommonMethods.AddLocalizeItem(localizeItemSelector, "th", item.NameTh != null ? item.NameTh : "PropertyValueNotSet"); CommonMethods.AddLocalizeItem(localizeItemSelector, "zn", item.NameCh != null ? item.NameCh : "PropertyValueNotSet"); if (item.PId == 0) { SetNavBarGroup(localizeItemSelector, item); var parentid = StructureItemsSource.OrderBy(a => a.DisplayIndex).Where(p => p.PId == item.Id); GenerateNavControlTreeStructure(parentid); } else { SetNavGroupSubItem(localizeItemSelector, item); } } }