/// <summary> /// Generate BarCrum Tree Items /// </summary> /// <param name="objlist">TreeItem Collection</param> private void GenerateBar(IEnumerable <SystemMenuTreeList> objlist) { try { Binding languageBinding = new Binding() { Source = this, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Path = new PropertyPath(BreadcrumbItem.LanguageProperty) }; LocalizeItemSelector localizeItemSelector; foreach (var item in objlist) { 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, "zh", item.NameTh != null ? item.NameTh : PropertyValueNotSet); if (item.PId == 0) { withChildBreadcrumbItem = new BreadcrumbItem(); withChildBreadcrumbItem.Header = localizeItemSelector.setLocalizeValue(withChildBreadcrumbItem, BreadcrumbItem.HeaderProperty); withChildBreadcrumbItem.PageUri = item.PageUri; withChildBreadcrumbItem.SetBinding(BreadcrumbItem.LanguageProperty, languageBinding); this.Items.Add(withChildBreadcrumbItem); var Parents1 = ItemSource.OrderBy(p => p.DisplayIndex).Where(p => p.PId == item.Id); if (Parents1.Any()) { GenerateBar(Parents1); } } else { withoutChildBreadcrumbItem = new BreadcrumbItem(); withoutChildBreadcrumbItem.PageUri = item.PageUri; withoutChildBreadcrumbItem.SetBinding(BreadcrumbItem.LanguageProperty, languageBinding); withoutChildBreadcrumbItem.Header = localizeItemSelector.setLocalizeValue(withoutChildBreadcrumbItem, BreadcrumbItem.HeaderProperty); if (!DicBreadCrumbItemAddressBar.ContainsKey(item.Id)) { DicBreadCrumbItemAddressBar.Add(item.Id, withoutChildBreadcrumbItem); } if (DicBreadCrumbItemAddressBar.ContainsKey(item.PId)) { DicBreadCrumbItemAddressBar[item.PId].Items.Add(withoutChildBreadcrumbItem); } else { withChildBreadcrumbItem.Items.Add(withoutChildBreadcrumbItem); } var Parents = ItemSource.OrderBy(p => p.DisplayIndex).Where(p => p.PId == item.Id); if (Parents.Any()) { GenerateBar(Parents); } } } } catch (Exception) { throw; } }