private CustGroupViewModel(CustGroup custgroup, CustGroupViewModel parent) { _custgroup = custgroup; _parent = parent; _children = new ObservableCollection<CustGroupViewModel>( (from child in _custgroup.Children select new CustGroupViewModel(child, this)) .ToList<CustGroupViewModel>()); }
private CustGroupViewModel(CustGroup custgroup, CustGroupViewModel parent) { _custgroup = custgroup; _parent = parent; _children = new ObservableCollection <CustGroupViewModel>( (from child in _custgroup.Children select new CustGroupViewModel(child, this)) .ToList <CustGroupViewModel>()); }
public CustGroupTreeViewModel(CustGroup root) { _root = new CustGroupViewModel(root); _firstGeneration = new ObservableCollection<CustGroupViewModel>( new CustGroupViewModel[] { _root }); _firstGeneration.CollectionChanged += _firstGeneration_CollectionChanged; _searchCommand = new SearchFamilyTreeCommand(this); }
public CustGroupTreeViewModel(CustGroup root) { _root = new CustGroupViewModel(root); _firstGeneration = new ObservableCollection <CustGroupViewModel>( new CustGroupViewModel[] { _root }); _firstGeneration.CollectionChanged += _firstGeneration_CollectionChanged; _searchCommand = new SearchFamilyTreeCommand(this); }
IEnumerable <CustGroupViewModel> FindMatches(string searchText, CustGroupViewModel person) { if (person.NameContainsText(searchText)) { yield return(person); } foreach (CustGroupViewModel child in person.Children) { foreach (CustGroupViewModel match in this.FindMatches(searchText, child)) { yield return(match); } } }
IEnumerable<CustGroupViewModel> FindMatches(string searchText, CustGroupViewModel person) { if (person.NameContainsText(searchText)) yield return person; foreach (CustGroupViewModel child in person.Children) foreach (CustGroupViewModel match in this.FindMatches(searchText, child)) yield return match; }