本文整理汇总了C#中TreeNode.AddChildTreeNode方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.AddChildTreeNode方法的具体用法?C# TreeNode.AddChildTreeNode怎么用?C# TreeNode.AddChildTreeNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode.AddChildTreeNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildInnerTree
private static TreeNode BuildInnerTree(XElement element, TreeNode parentNode, Tree tree)
{
TreeNode treeNode = TreeNodeCreatorFactory.CreateTreeNode(element, tree);
if (treeNode == null) return null;
// Actions
XElement actionsElement = element.Element(TreeMarkupConstants.Namespace + "Actions");
if (actionsElement != null)
{
foreach (XElement actionElement in actionsElement.Elements())
{
ActionNode actionNode = ActionNodeCreatorFactory.CreateActionNode(actionElement, tree);
if (actionNode != null)
{
treeNode.AddActionNode(actionNode);
}
}
}
// OrderBys
XElement orderBysElement = element.Element(TreeMarkupConstants.Namespace + "OrderBy");
if (orderBysElement != null)
{
foreach (XElement orderByElement in orderBysElement.Elements())
{
OrderByNode orderByNode = OrderByNodeCreatorFactory.CreateOrderByNode(orderByElement, tree);
if (orderByNode != null)
{
treeNode.AddOrderByNode(orderByNode);
}
}
}
// Filters
XElement filtersElement = element.Element(TreeMarkupConstants.Namespace + "Filters");
if (filtersElement != null)
{
foreach (XElement filterElement in filtersElement.Elements())
{
FilterNode filterNode = FilterNodeCreatorFactory.CreateFilterNode(filterElement, tree);
if (filterNode != null)
{
treeNode.AddFilterNode(filterNode);
}
}
}
if (parentNode != null)
{
parentNode.AddChildTreeNode(treeNode);
}
// Children
XElement childrenElement = element.Element(TreeMarkupConstants.Namespace + "Children");
if (childrenElement != null)
{
foreach (XElement childElement in childrenElement.Elements())
{
BuildInnerTree(childElement, treeNode, tree);
}
}
treeNode.InitializeActions();
treeNode.InitializeOrderByes();
treeNode.InitializeFilters();
return treeNode;
}