Exemplo n.º 1
0
        //public static T GetNodeData<T>(this TreeNode @this) where T : ITreeNodeData
        public static ITreeNodeData GetNodeData(this TreeNode @this)
        {
            if (@this == null)
            {
                return(null);
            }

            TreeNodeProxy nodeProxy = @this.GetNodeProxy();

            return(nodeProxy.GetNodeData());
        }
Exemplo n.º 2
0
        public static TreeNode CreateNewItemNode(this LabelEditEnhancedTreeView @this)
        {
            ITreeNodeData treeNodeData = @this.CreateNewNodeData(TreeNodeProxy.NEW_ITEM_NODE_TEXT);
            TreeNode      treeNode     = CreateNode(@this, treeNodeData);

            treeNode.ForeColor          = Color.Gray;
            treeNode.ImageIndex         = 0;
            treeNode.StateImageIndex    = 0;
            treeNode.SelectedImageIndex = 0;
            TreeNodeProxy treeNodeProxy = treeNode.GetNodeProxy();

            treeNodeProxy.IsNewItemNode = true;
            return(treeNode);
        }
Exemplo n.º 3
0
        public static TreeNode CreateNode <T>(this LabelEditEnhancedTreeView @this, T nodeData)
            where T : ITreeNodeData
        {
            string        displayValue  = nodeData == null ? string.Empty : nodeData.DisplayValue;
            TreeNode      treeNode      = @this.Nodes.Add(displayValue);
            bool          isNewItemNode = nodeData == null;
            TreeNodeProxy nodeProxy     = new TreeNodeProxy <T>(nodeData, isNewItemNode);
            int           iconIndex     = isNewItemNode ? 0 : nodeData.IconIndex;

            treeNode.ImageIndex         = iconIndex;
            treeNode.StateImageIndex    = iconIndex;
            treeNode.SelectedImageIndex = iconIndex;

            treeNode.SetNodeProxy(nodeProxy);
            return(treeNode);
        }
Exemplo n.º 4
0
 internal static void SetNodeProxy(this TreeNode @this, TreeNodeProxy nodeProxy)
 {
     @this.Tag = nodeProxy;
 }