Ejemplo n.º 1
0
 public TreeViewModel(TreeObject rootTreeObject)
 {
     _rootObject = new TreeObjectViewModel(rootTreeObject);
     _topLevel   = new ReadOnlyCollection <TreeObjectViewModel>(
         new TreeObjectViewModel[] { _rootObject });
     _searchCommand = new SearchTreeCommand(this);
     ShowTree       = true;
 }
 private TreeObjectViewModel(TreeObject inTopObject, TreeObjectViewModel parent)
 {
     _treeObject = inTopObject;
     _parent     = parent;
     _children   = new ReadOnlyCollection <TreeObjectViewModel>(
         (from child in _treeObject.Children
          select new TreeObjectViewModel(child, this))
         .ToList <TreeObjectViewModel>());
 }
Ejemplo n.º 3
0
 IEnumerable <TreeObjectViewModel> FindMatches(string searchText, TreeObjectViewModel treeObject)
 {
     if (treeObject.NameContainsText(searchText))
     {
         yield return(treeObject);
     }
     foreach (TreeObjectViewModel child in treeObject.Children)
     {
         foreach (TreeObjectViewModel match in this.FindMatches(searchText, child))
         {
             yield return(match);
         }
     }
 }