当前位置: 首页>>代码示例>>C#>>正文


C# TreeNodeCollection.Cast方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.TreeNodeCollection.Cast方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNodeCollection.Cast方法的具体用法?C# TreeNodeCollection.Cast怎么用?C# TreeNodeCollection.Cast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.TreeNodeCollection的用法示例。


在下文中一共展示了TreeNodeCollection.Cast方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsChildNodeSelected

        /// <summary>
        /// Determines whether [is child node selected] [the specified nodes].
        /// </summary>
        /// <param name="nodes">
        /// The nodes.
        /// </param>
        /// <returns>
        /// <c>true</c> if [is child node selected] [the specified nodes]; otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// </remarks>
        private bool IsChildNodeSelected(TreeNodeCollection nodes)
        {
            var bRet = false;

            if (nodes != null)
            {
                bRet = nodes.Cast<TreeNode>().Any(node => node.Selected || this.IsChildNodeSelected(node.ChildNodes));
            }

            return bRet;
        }
开发者ID:divyang4481,项目名称:appleseedapp,代码行数:22,代码来源:TreeViewAdapter.cs

示例2: ExpandToDepth

        /// <summary>
        /// The expand to depth.
        /// </summary>
        /// <param name="nodes">
        /// The nodes.
        /// </param>
        /// <param name="expandDepth">
        /// The expand depth.
        /// </param>
        public static void ExpandToDepth(TreeNodeCollection nodes, int expandDepth)
        {
            if (nodes == null)
            {
                return;
            }

            foreach (var node in nodes.Cast<TreeNode>().Where(node => node.Depth < expandDepth))
            {
                node.Expand();
                ExpandToDepth(node.ChildNodes, expandDepth);
            }
        }
开发者ID:divyang4481,项目名称:appleseedapp,代码行数:22,代码来源:TreeViewAdapter.cs

示例3: ComposeViewState

        /// <summary>
        /// Composes the state of the view.
        /// </summary>
        /// <param name="nodes">
        /// The nodes.
        /// </param>
        /// <param name="state">
        /// The state.
        /// </param>
        /// <returns>
        /// The compose view state.
        /// </returns>
        /// <remarks>
        /// </remarks>
        private string ComposeViewState(TreeNodeCollection nodes, string state)
        {
            if (nodes != null)
            {
                foreach (var node in nodes.Cast<TreeNode>().Where(IsExpandable))
                {
                    if (node.Expanded.Equals(true))
                    {
                        state += "e";
                        state = this.ComposeViewState(node.ChildNodes, state);
                    }
                    else
                    {
                        state += "n";
                    }
                }
            }

            return state;
        }
开发者ID:divyang4481,项目名称:appleseedapp,代码行数:34,代码来源:TreeViewAdapter.cs

示例4: CheckNode

 //初始化要选中的项
 private void CheckNode(TreeNodeCollection nodes, IList<string> valuelist, ref int depth)
 {
     foreach (var node in nodes.Cast<TreeNode>())
     {
         if (valuelist.Contains(node.Value))
         {
             node.Checked = true;
             depth = Math.Max(depth, node.Depth);
         }
         if (node.ChildNodes.Count > 0)
         {
             CheckNode(node.ChildNodes, valuelist, ref depth);
         }
     }
 }
开发者ID:vinlon,项目名称:joyvio,代码行数:16,代码来源:UCTreeView.ascx.cs


注:本文中的System.Web.UI.WebControls.TreeNodeCollection.Cast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。