コード例 #1
0
        private VariableTreeNodeViewModel(VariableTree.VariableTreeNode node, VariableTreeNodeViewModel parent)
        {
            _node     = node;
            _parent   = parent;
            _children = new ObservableCollection <VariableTreeNodeViewModel>();
            _children.Add(DummyChild);

            //            _children = new ReadOnlyCollection<VariableTreeNodeViewModel>(
//                    (from KeyValuePair<String, VariableTree.VariableTreeNode> entry in _node.children
//                     select new VariableTreeNodeViewModel(entry.Value, this))
//                     .ToList<VariableTreeNodeViewModel>());
        }
コード例 #2
0
        public VariableTreeViewModel(VariableTree.VariableTree dataTree)
        {
            _rootNode = new VariableTreeNodeViewModel(dataTree.rootNode);

            _firstGeneration = new ReadOnlyCollection <VariableTreeNodeViewModel>(
                new VariableTreeNodeViewModel[]
            {
                _rootNode
            });

            _rootNode.IsExpanded = true;

            _searchCommand = new SearchFamilyTreeCommand(this);
        }
コード例 #3
0
        IEnumerable <VariableTreeNodeViewModel> FindMatches(string searchText, VariableTreeNodeViewModel person)
        {
            if (person.NameContainsText(searchText))
            {
                yield return(person);
            }

            foreach (VariableTreeNodeViewModel child in person.Children)
            {
                foreach (VariableTreeNodeViewModel match in this.FindMatches(searchText, child))
                {
                    yield return(match);
                }
            }
        }