Пример #1
0
        /// <summary>
        /// Adds a node for the specified item
        /// </summary>
        /// <param name="item"></param>
        private void AddNode(object item)
        {
            var node = new BindingTreeNode(_tree, item, _bindingTreeView);

            _nodeCollection.Add(node);
            node.UpdateDisplay();
        }
Пример #2
0
        /// <summary>
        /// Updates the node at the specified index, with the specified item
        /// </summary>
        /// <param name="index"></param>
        /// <param name="item"></param>
        private void UpdateNode(int index, object item)
        {
            BindingTreeNode node = (BindingTreeNode)_nodeCollection[index];

            node.DataBoundItem = item;
            node.UpdateDisplay();   // force update, even if it is the same item, because its properties may have changed
        }
Пример #3
0
        /// <summary>
        /// Builds or rebuilds the entire level
        /// </summary>
        private void BuildLevel()
        {
            // dispose of all existing tree nodes before clearing the collection
            foreach (TreeNode node in _nodeCollection)
            {
                if (node is IDisposable)
                {
                    (node as IDisposable).Dispose();
                }
            }

            _nodeCollection.Clear();

            // create new node for each item
            foreach (object item in _tree.Items)
            {
                BindingTreeNode node = new BindingTreeNode(_tree, item, _bindingTreeView);
                _nodeCollection.Add(node);
                node.UpdateDisplay();
            }
        }
Пример #4
0
 /// <summary>
 /// Adds a node for the specified item
 /// </summary>
 /// <param name="item"></param>
 private void AddNode(object item)
 {
     var node = new BindingTreeNode(_tree, item, _bindingTreeView);
     _nodeCollection.Add(node);
     node.UpdateDisplay();
 }
Пример #5
0
        /// <summary>
        /// Builds or rebuilds the entire level
        /// </summary>
        private void BuildLevel()
        {
			// dispose of all existing tree nodes before clearing the collection
        	foreach (TreeNode node in _nodeCollection)
        	{
        		if(node is IDisposable)
					(node as IDisposable).Dispose();
        	}

            _nodeCollection.Clear();

			// create new node for each item
            foreach (object item in _tree.Items)
            {
				BindingTreeNode node = new BindingTreeNode(_tree, item, _bindingTreeView);
                _nodeCollection.Add(node);
                node.UpdateDisplay();
            }
        }