VitNX_TreeView.ToggleNode Method
This language is not supported or no code example is available.
Parameters
-
node
-
VitNX_TreeNode
public void ToggleNode(VitNX_TreeNode node)
{
if (_selectedNodes.Contains(node))
{
_selectedNodes.Remove(node);
// If we just removed both the anchor start AND end then reset them
if (_anchoredNodeStart == node && _anchoredNodeEnd == node)
{
if (_selectedNodes.Count > 0)
{
_anchoredNodeStart = _selectedNodes[0];
_anchoredNodeEnd = _selectedNodes[0];
}
else
{
_anchoredNodeStart = null;
_anchoredNodeEnd = null;
}
}
// If we just removed the anchor start then update it accordingly
if (_anchoredNodeStart == node)
{
if (_anchoredNodeEnd.VisibleIndex < node.VisibleIndex)
_anchoredNodeStart = node.PrevVisibleNode;
else if (_anchoredNodeEnd.VisibleIndex > node.VisibleIndex)
_anchoredNodeStart = node.NextVisibleNode;
else
_anchoredNodeStart = _anchoredNodeEnd;
}
// If we just removed the anchor end then update it accordingly
if (_anchoredNodeEnd == node)
{
if (_anchoredNodeStart.VisibleIndex < node.VisibleIndex)
_anchoredNodeEnd = node.PrevVisibleNode;
else if (_anchoredNodeStart.VisibleIndex > node.VisibleIndex)
_anchoredNodeEnd = node.NextVisibleNode;
else
_anchoredNodeEnd = _anchoredNodeStart;
}
}
else
{
_selectedNodes.Add(node);
_anchoredNodeStart = node;
_anchoredNodeEnd = node;
}
Invalidate();
}
This language is not supported or no code example is available.
.NET Framework
Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
.NET Core
Supported in: 5.0+, 6.0+