private ZenfolioTreeViewModel(GroupElement groupElement, ZenfolioTreeViewModel parent) { GroupElement = groupElement; Parent = parent; if (groupElement is Group) { Children = (GroupElement as Group).Elements != null ? new ObservableCollection <ZenfolioTreeViewModel>( (from child in (GroupElement as Group).Elements select new ZenfolioTreeViewModel(child, this)) .ToList <ZenfolioTreeViewModel>()) : null; } }
IEnumerable <ZenfolioTreeViewModel> FindMatches(string searchText, ZenfolioTreeViewModel person) { if (person.NameContainsText(searchText)) { yield return(person); } foreach (ZenfolioTreeViewModel child in person.Children) { foreach (ZenfolioTreeViewModel match in this.FindMatches(searchText, child)) { yield return(match); } } }
private void RefreshRootGroup(ZenfolioTreeViewModel rootGroup) { FirstGeneration = new ObservableCollection <ZenfolioTreeViewModel>(new ZenfolioTreeViewModel[] { rootGroup }); }