private List <CheckableTreeViewItem> buildCheckableTreeView(CandidateRootElement ma) { var checkableTreeViewItems = new List <CheckableTreeViewItem>(); foreach (IAsma asma in ma.OriginalMa.Asmas) { if (asma.AssociatedBieAggregator.IsMa) { var currentItem = new CheckableTreeViewItem(asma.AssociatedBieAggregator.Ma.Name, idCounter++) { Parent = null }; currentItem.Children = findChildren(currentItem, asma.AssociatedBieAggregator.Ma); checkableTreeViewItems.Add(currentItem); } else if (asma.AssociatedBieAggregator.IsAbie) { rootElement.CandidateAbies.Add(new CandidateAbie(asma.AssociatedBieAggregator.Abie, AbieFindChildren(asma.AssociatedBieAggregator.Abie))); var currentItem = new CheckableTreeViewItem(true, asma.AssociatedBieAggregator.Abie.Name, idCounter++) { Parent = null }; currentItem.Children = findChildren(currentItem, asma.AssociatedBieAggregator.Abie); checkableTreeViewItems.Add(currentItem); } } //also visualize Root Element in Tree! var root = new CheckableTreeViewItem(ma.OriginalMa.Name, idCounter++) { Children = new ObservableCollection <CheckableTreeViewItem>(checkableTreeViewItems) }; return(new List <CheckableTreeViewItem> { root }); }
public void SetSelectedCandidateDocLibrary(string selectedDocLibrary) { foreach (CandidateDocLibrary candidateDocLibrary in mCandidateDocLibraries) { if (candidateDocLibrary.OriginalDocLibrary.Name.Equals(selectedDocLibrary)) { candidateDocLibrary.Selected = true; rootElement = new CandidateRootElement(candidateDocLibrary.OriginalDocLibrary.DocumentRoot) { CandidateAbies = new List <CandidateAbie>() }; RootElement = rootElement.OriginalMa.Name; mCandidateAbieItems.Clear(); mCandidateAbieItems = buildCheckableTreeView(rootElement); CandidateAbieItems = new ObservableCollection <CheckableTreeViewItem>(mCandidateAbieItems); return; //override selection of root Element! //CandidateRootElementNames = new List<string>(candidateDocLibrary.CandidateRootElements.ConvertAll(new Converter<CandidateRootElement, string>(CandidateRootElementToString))); } candidateDocLibrary.Selected = false; } }