コード例 #1
0
        /// <summary>
        /// Sets the expanded state of each child node in the specified node.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="expandedState">The expanded state of each node.</param>
        private void SetExpandedState(BindableTreeNode node, Dictionary <Guid, bool> expandedState)
        {
            if (expandedState.ContainsKey(node.ID))
            {
                if (expandedState[node.ID] && !node.IsExpanded)
                {
                    node.Expand();
                }
                else if (expandedState[node.ID] && node.IsExpanded)
                {
                    node.Collapse();
                }
            }

            foreach (BindableTreeNode childNode in node.Nodes)
            {
                SetExpandedState(childNode, expandedState);
            }
        }