Here is more optimal way to hide/show all nodes (it is enough to hide zero-level nodes to hide/show ALL nodes):
[C#]
private void HideShowRows(FlyGrid flyGrid, bool hide)
{
flyGrid.BeginInit();
try
{
foreach(Node node in flyGrid.Rows.Items)
node.Hidden = hide;
}
finally
{
flyGrid.EndInit();
}
}
If you need to totally hide/show nodes:
[C#]
private void HideShowNodes(FlyGrid flyGrid, bool hide)
{
flyGrid.BeginInit();
try
{
HideShowNodes(flyGrid.Rows.Items, hide);
}
finally
{
flyGrid.EndInit();
}
}
private void HideShowNodes(NodeCollection nodes, bool hide)
{
foreach(Node node in nodes)
{
if (node.HasChildren)
HideShowNodes(node.Items, hide);
node.Hidden = hide;
}
}