private void ToggleChildrenVisibility(HierarchicalNodeViewModel node, bool areChildrenVisible) { foreach (Node subNode in node.Children) { var visibility = areChildrenVisible ? Visibility.Visible : Visibility.Collapsed; subNode.Visibility = visibility; subNode.IsSelected = false; this.GraphSource.InternalLinks.Where(link => link.Source == node).ToList() .ForEach(link => { link.Visibility = visibility; link.IsSelected = false; }); if (subNode.AreChildrenCollapsed) { continue; } this.ToggleChildrenVisibility(subNode, areChildrenVisible); } this.OnChildrenExpandedOrCollapsed(); }
private void ToggleChildrenVisibility(HierarchicalNodeViewModel node, bool areChildrenVisible) { foreach (Node subNode in node.Children) { var visibility = areChildrenVisible ? Visibility.Visible : Visibility.Collapsed; subNode.Visibility = visibility; subNode.IsSelected = false; this.GraphSource.InternalLinks.Where(link => link.Source == node).ToList() .ForEach(link => { link.Visibility = visibility; link.IsSelected = false; }); if (subNode.AreChildrenCollapsed) continue; this.ToggleChildrenVisibility(subNode, areChildrenVisible); } this.OnChildrenExpandedOrCollapsed(); }