示例#1
0
        /// <summary>
        /// This method starts with this legend item and tests to see if it can contain
        /// the specified target.  As it moves up the
        /// </summary>
        /// <param name="startItem">This legend item</param>
        /// <param name="dropItem">The target legend item to test</param>
        /// <returns>An ILegendItem that is one of the parent items of this item, but that can receive the target.</returns>
        public static ILegendItem GetValidContainerFor(this ILegendItem startItem, ILegendItem dropItem)
        {
            if (startItem == null)
            {
                return(null);
            }
            if (dropItem == null)
            {
                return(null);
            }
            if (startItem.CanReceiveItem(dropItem))
            {
                return(startItem);
            }
            ILegendItem item = startItem;

            while ((item = item.GetParentItem()) != null)
            {
                if (item.CanReceiveItem(dropItem))
                {
                    return(item);
                }
            }
            return(null);
        }
示例#2
0
        private static ILegendItem GetInsertTarget(ILegendItem startItem, ILegendItem dropItem)
        {
            if (startItem == null)
            {
                return(null);
            }
            if (dropItem == null)
            {
                return(null);
            }
            if (startItem.CanReceiveItem(dropItem))
            {
                return(startItem);
            }
            ILegendItem item = startItem;

            while (item.GetParentItem() != null)
            {
                if (item.GetParentItem().CanReceiveItem(dropItem))
                {
                    return(item);
                }
                item = item.GetParentItem();
            }
            return(null);
        }
示例#3
0
 private static ILegendItem GetInsertTarget(ILegendItem startItem, ILegendItem dropItem)
 {
     if (startItem == null) return null;
     if (dropItem == null) return null;
     if (startItem.CanReceiveItem(dropItem)) return startItem;
     ILegendItem item = startItem;
     while (item.GetParentItem() != null)
     {
         if (item.GetParentItem().CanReceiveItem(dropItem))
         {
             return item;
         }
         item = item.GetParentItem();
     }
     return null;
 }