Пример #1
0
        private ProjectTreeNode GetFirstVisibleParentNode(ProjectTreeNode projectNode)
        {
            if (!IsNodeVisible(projectNode))
            {
                return(projectNode);
            }

            var treeViewItem = ProjectTreeView.ModelToItem(projectNode);

            if (treeViewItem != null)
            {
                return(projectNode);
            }

            while (projectNode?.Parent != null)
            {
                treeViewItem = ProjectTreeView.ModelToItem(projectNode.Parent);
                if (treeViewItem != null)
                {
                    return(projectNode.Parent);
                }

                projectNode = projectNode.Parent;
            }

            return(projectNode);
        }