/// <summary> 判断是否允许拖动到指定节点下[不允许拖动到被选中节点和它的子节点下] /// /// </summary> /// <param name="DragedContainer"></param> /// <returns></returns> private bool AllowDrag(MindMapNodeContainer DragedContainer) { #region 获取所有选中节点和他的子节点 List <MindMapNodeContainer> NodeContainerList = GetSelectedNode(); //获取所有选中节点 List <MindMapNodeContainer> SelectedAndChidrenList = new List <MindMapNodeContainer>(); SelectedAndChidrenList.AddRange(NodeContainerList); //获取选中节点 NodeContainerList.ForEach(T1 => SelectedAndChidrenList.AddRange(T1.GetChidrenNode(true))); //获取选中节点的子节点 SelectedAndChidrenList = SelectedAndChidrenList.Distinct().ToList(); //去重,两个已选中节点可能是父子关系 #endregion 获取所有选中节点和他的子节点 if (SelectedAndChidrenList.Contains(DragedContainer))//不允许拖动到被选中节点和它的子节点下 { return(false); } return(true); }