private void OnNodeClicked(StackNodeEventArgs e)
 {
     if (StackNodeClick != null)
     {
         StackNodeClick(this, e);
     }
 }
        public void OnSelectionChanged(StackNodeEventArgs e)
        {
            this.SuspendDrawing();
            if (_selectedNode != null)
            {
                _selectedNode.BackColor = Color.White;
                _selectedNode.ForeColor = Color.Black;
            }
            _selectedNode           = e.Node;
            _selectedNode.BackColor = this.SelectionColor;
            _selectedNode.ForeColor = this.SelectionForeColor;

            if (e.Node.Nodes.Count == 0)
            {
                var p = SelectedNode.ParentNode;
                while (p != null)
                {
                    p.Expand();
                    p = p.ParentNode;
                }
                pnlMain.ScrollControlIntoView(SelectedNode.Parent);
            }
            this.ResumeDrawing();
            if (SelectionChanged != null)
            {
                SelectionChanged(this, e);
            }
        }
        private void OnSelectionChanged(object sender, StackNodeEventArgs e)
        {
            SampleItem sample = e.Node.Tag as SampleItem;

            if (sample != null)
            {
                SelectionChanged(this, new SideBarEventArgs(sample));
            }
        }
        private void OnNodeAdded(object sender, StackNodeEventArgs e)
        {
            var node = e.Node;

            node.ForeColor       = this.ForeColor;
            node.BackColor       = this.BackColor;
            node.Level           = this.Level + 1;
            node.StackedTree     = this.StackedTree;
            node.ParentNode      = this;
            node.Width           = Width;
            node.StackNodeClick += (s, ev) => this.OnNodeClicked(ev);
            this.childPanel.Controls.Add(node);
        }
        private void OnNodeAdded(object sender, StackNodeEventArgs e)
        {
            var node = e.Node;

            node.ForeColor   = this.ForeColor;
            node.BackColor   = this.BackColor;
            node.Width       = Width;
            node.Level       = 0;
            node.StackedTree = this;
            node.ParentNode  = null;
            node.IsVisible   = true;
            this.pnlMain.Controls.Add(node);
            node.StackNodeClick += (s, ev) => this.OnSelectionChanged(ev);
        }