Tree node that represents a component property.
Inheritance: System.Windows.Forms.TreeNode
Ejemplo n.º 1
0
        /// <summary>
        /// Creates a node for a regular property.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="component">The component.</param>
        /// <returns>The tree node for the property.</returns>
        private TreeNode CreatePropertyNode(PropertyDescriptor property, object component)
        {
            PropertyTreeNode propertyTreeNode = new PropertyTreeNode(property, component);

            propertyTreeNode.PropertyValueChanged +=
                delegate(object sender, EventArgs e) { this._propertyGrid.SelectedObject = propertyTreeNode.PropertyValue; };

            return(propertyTreeNode);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Event handler for the tree view NodeSelect event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.TreeViewEventArgs"/> instance containing the event data.</param>
        private void HandleTreeNodeSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode selectedNode = _configurationTreeView.SelectedNode;

            _propertyGrid.SelectedObject = null;

            if (selectedNode != null)
            {
                PropertyTreeNode propertyNode = selectedNode as PropertyTreeNode;
                if (propertyNode != null && !(propertyNode is ListPropertyTreeNode))
                {
                    _propertyGrid.SelectedObject = propertyNode.PropertyValue;
                }
                else if (selectedNode.Tag != null && !(selectedNode.Tag is IList))
                {
                    _propertyGrid.SelectedObject = selectedNode.Tag;
                }
            }
        }
        /// <summary>
        /// Creates a node for a regular property.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="component">The component.</param>
        /// <returns>The tree node for the property.</returns>
        private TreeNode CreatePropertyNode(PropertyDescriptor property, object component)
        {
            PropertyTreeNode propertyTreeNode = new PropertyTreeNode(property, component);
            propertyTreeNode.PropertyValueChanged += delegate(object sender, EventArgs e)
            {
                this._propertyGrid.SelectedObject = propertyTreeNode.PropertyValue;
            };

            return propertyTreeNode;
        }