List <ITreeViewItem> ITreeViewItem.Childrens() { List <ITreeViewItem> Childrens = new List <ITreeViewItem>(); ObservableList <RepositoryFolder <ApplicationPOMModel> > subFolders = mPOMModelFolder.GetSubFolders(); foreach (RepositoryFolder <ApplicationPOMModel> pomFolder in subFolders) { ApplicationPOMsTreeItem pomFTVI = new ApplicationPOMsTreeItem(pomFolder); Childrens.Add(pomFTVI); } subFolders.CollectionChanged -= TreeFolderItems_CollectionChanged; // untrack sub folders subFolders.CollectionChanged += TreeFolderItems_CollectionChanged; // track sub folders //Add direct childrens mChildPoms = mPOMModelFolder.GetFolderItems(); mChildPoms.CollectionChanged -= TreeFolderItems_CollectionChanged; mChildPoms.CollectionChanged += TreeFolderItems_CollectionChanged;//adding event handler to add/remove tree items automatically based on folder items collection changes foreach (ApplicationPOMModel pom in mChildPoms.OrderBy(nameof(ApplicationPOMModel.Name))) { ApplicationPOMTreeItem pomTI = new ApplicationPOMTreeItem(pom); Childrens.Add(pomTI); } return(Childrens); }
List <ITreeViewItem> ITreeViewItem.Childrens() { List <ITreeViewItem> Childrens = new List <ITreeViewItem>(); foreach (RepositoryFolder <ApplicationPOMModel> POMFolder in mPOMModelFolder.GetSubFolders()) { ApplicationPOMsTreeItem apiFTVI = new ApplicationPOMsTreeItem(POMFolder); Childrens.Add(apiFTVI); } //Add direct childrens foreach (ApplicationPOMModel api in mPOMModelFolder.GetFolderItems()) { ApplicationPOMTreeItem apiTI = new ApplicationPOMTreeItem(api); Childrens.Add(apiTI); } return(Childrens); }