本文整理汇总了C#中ITreeNode.ContainsDescendent方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeNode.ContainsDescendent方法的具体用法?C# ITreeNode.ContainsDescendent怎么用?C# ITreeNode.ContainsDescendent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITreeNode
的用法示例。
在下文中一共展示了ITreeNode.ContainsDescendent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FirstRemainingParent
/// <summary>Retrieves the first ancestor of a node that still exists as a descendent of the root node.</summary>
/// <param name="root">The root node.</param>
/// <param name="orphan">The orphaned node.</param>
/// <remarks>Useful for when a node is removed, and you want to move a view to the reamining parent.</remarks>
public ITreeNode FirstRemainingParent(ITreeNode root, ITreeNode orphan)
{
if (root == null || orphan == null) return null;
ITreeNode parent = orphan.Parent;
do
{
if (parent == null) break;
if (parent == root || root.ContainsDescendent(parent)) return parent;
parent = parent.Parent;
} while (parent != null);
return null;
}
示例2: GetSlideDirection
private static HorizontalEdge GetSlideDirection(ITreeNode previousNode, ITreeNode newNode)
{
if (previousNode == null) return HorizontalEdge.Left;
return previousNode.ContainsDescendent(newNode)
? HorizontalEdge.Left
: HorizontalEdge.Right;
}