예제 #1
0
파일: Branch.cs 프로젝트: BDisp/gui.cs
        /// <summary>
        /// Expands the current branch if possible
        /// </summary>
        public void Expand()
        {
            if (ChildBranches == null)
            {
                FetchChildren();
            }

            if (ChildBranches.Any())
            {
                IsExpanded = true;
            }
        }
예제 #2
0
파일: Branch.cs 프로젝트: BDisp/gui.cs
        /// <summary>
        /// Returns true if the current branch can be expanded according to
        /// the <see cref="TreeBuilder{T}"/> or cached children already fetched
        /// </summary>
        /// <returns></returns>
        public bool CanExpand()
        {
            // if we do not know the children yet
            if (ChildBranches == null)
            {
                //if there is a rapid method for determining whether there are children
                if (tree.TreeBuilder.SupportsCanExpand)
                {
                    return(tree.TreeBuilder.CanExpand(Model));
                }

                //there is no way of knowing whether we can expand without fetching the children
                FetchChildren();
            }

            //we fetched or already know the children, so return whether we have any
            return(ChildBranches.Any());
        }