private void EndUpdateCTreeView() { if (OwnerCTreeView != null) { OwnerCTreeView.EndUpdate(); } }
private void BeginUpdateCTreeView() { if (OwnerCTreeView != null) { OwnerCTreeView.BeginUpdate(); } }
/// <summary> /// Raises the SelectNode event. /// </summary> /// <param name="e">A CTreeViewEventArgs that contains the event data</param> protected internal virtual void OnSelectNode(CTreeViewEventArgs e) { //ParentCTreeView.Invalidate(); //ParentCTreeView.Update(); OwnerCTreeView.Refresh(); if (SelectNode != null) { SelectNode(this, e); } }
/// <summary> /// Expands the tree node. /// </summary> public void Expand() { IsExpanded = true; //if (Visible) foreach (CTreeNode child in Nodes) child.Visible = true; //Nodes.TraverseNodes(node => node.ParentNode.IsExpanded, node => { node.IsShown = true; }); if (OwnerCTreeView != null) { OwnerCTreeView.OnExpandNode(new CTreeViewEventArgs(this)); } }
/// <summary> /// Collapses the tree node. /// </summary> public void Collapse() { IsExpanded = false; //foreach (CTreeNode child in Nodes) child.Visible = false; //Nodes.TraverseNodes(node => node.IsShown, node => { node.IsShown = false; }); if (OwnerCTreeView != null) { OwnerCTreeView.OnCollapseNode(new CTreeViewEventArgs(this)); } }
/// <summary> /// /// </summary> public void Drag() { if (OwnerCTreeView.DragAndDropMode != CTreeViewDragAndDropMode.Nothing && IsSelected) { //Checking that all selected nodes has same parent bool checkSameParent = true; foreach (CTreeNode selectedNode in OwnerCTreeView.SelectedNodes) { if (selectedNode.ParentNode != OwnerCTreeView.SelectedNodes[0].ParentNode) { checkSameParent = false; } } //Prepare and sort the dragged nodes if (checkSameParent) { List <CTreeNode> draggedNodes = new List <CTreeNode>(OwnerCTreeView.SelectedNodes); draggedNodes.Sort((node1, node2) => node1.Index - node2.Index); OwnerCTreeView.DoDragDrop(draggedNodes, DragDropEffects.All); } } }