/// <summary> /// Drag complete. /// </summary> /// <param name="layerageCollection"> The layerage-collection. </param> /// <param name="destination"> The destination layerage. </param> /// <param name="source"> The source layerage. </param> /// <param name="destinationOverlayMode"> The destination OverlayMode. </param> /// <param name="sourceIsSelected"> The source SelectMode. </param> public static void DragComplete(LayerageCollection layerageCollection, Layerage destination, Layerage source, OverlayMode destinationOverlayMode, bool sourceIsSelected) { if (source == null) { return; } if (destination == null) { return; } ILayer destinationLayer = destination.Self; ILayer sourceLayer = source.Self; destinationLayer.Control.OverlayMode = OverlayMode.None; if (destinationLayer.IsSelected) { return; } if (destinationOverlayMode == OverlayMode.None) { return; } if (source == destination) { return; } bool isSelected = sourceLayer.IsSelected; if (isSelected == false) { switch (destinationOverlayMode) { case OverlayMode.Top: LayerageCollection.Insert(layerageCollection, destination, source, isBottomInsert: false); break; case OverlayMode.Center: LayerageCollection.Add(layerageCollection, destination, source); break; case OverlayMode.Bottom: LayerageCollection.Insert(layerageCollection, destination, source, isBottomInsert: true); break; } } else { //Layerages IEnumerable <Layerage> selectedLayerages = LayerageCollection.GetAllSelected(layerageCollection); switch (destinationOverlayMode) { case OverlayMode.Top: LayerageCollection.InsertRange(layerageCollection, destination, selectedLayerages, isBottomInsert: false); break; case OverlayMode.Center: LayerageCollection.AddRange(layerageCollection, destination, selectedLayerages); break; case OverlayMode.Bottom: LayerageCollection.InsertRange(layerageCollection, destination, selectedLayerages, isBottomInsert: true); break; } } }