Exemple #1
0
        private void Bind(TreeNode parent, IDomainHierarchy item, IDomainHierarchy target)
        {
            var node = new TreeNode {Text = item.Title, Value = item.Id.ToString(), Selected = item.Equals(target)};

            SetImage(node, item);

            parent.ChildNodes.Add(node);

            if (node.Selected && ExpandToSelectedNode)
            {
                ExpandUp(node);
            }

            foreach (var child in item.GetChildren()) Bind(node, child as IDomainHierarchy, target);
        }
Exemple #2
0
        private void Bind(TreeView tree, IDomainHierarchy root, IDomainHierarchy target)
        {
            var node = new TreeNode {Text = root.Title, Value = root.Id.ToString(), Selected = root.Equals(target)};

            SetImage(node, root);

            tree.Nodes.Add(node);

            foreach (var child in root.GetChildren()) Bind(node, child as IDomainHierarchy, target);
        }