Provides data for the TreeView.BeforeCheck, TreeView.BeforeCollapse, TreeView.BeforeExpand, and TreeView.BeforeSelect events of a TreeView control.
Inheritance: CancelEventArgs
 private void _treeView_OnBeforeSelect(object sender, TreeViewCancelEventArgs e)
 {
     if (_gridControl.Grid == null || _gridControl.Grid.BusinessObjectCollection == null) return;
     if (_gridControl.Grid.BusinessObjectCollection.IsDirty)
     {
         DialogResult result = _controlFactory.ShowMessageBox("Do you want to save changes?",
             "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
         switch (result)
         {
             case DialogResult.Yes:
                 e.Cancel = !SaveChanges();
                 break;
             case DialogResult.No:
                 e.Cancel = !RejectChanges();
                 break;
             default:
                 e.Cancel = true;
                 break;
         }
     }
 }
        //private void SetSelectedNode(ITreeNode newSelectedNode)
        //{
        //    if (_selectedNode != null)
        //    {
        //        _selectedNode.BackColor = _treeView.BackColor;
        //        _selectedNode.ForeColor = _treeView.ForeColor;
        //    }
        //    _selectedNode = newSelectedNode;
        //    if (_selectedNode != null)
        //    {
        //        _selectedNode.BackColor = SystemColors.Highlight;
        //        _selectedNode.ForeColor = SystemColors.HighlightText;
        //    }
        //}

        private void TreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            ExpandNode(e.Node);
        }