Browse Source

Copy & Paste of Items -> Keep the old Position, don't move all Elements to the upper corner.

This works, because before the Action was AddItem, and then the DefaultPlacementBehavior tries to set the position!
This should not be done by paste from Clipboard
pull/52/head
jogibear9988 12 years ago committed by jkuehner
parent
commit
7946cee208
  1. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlEditOperations.cs
  2. 6
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementType.cs

2
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlEditOperations.cs

@ -161,7 +161,7 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml
void AddInParent(DesignItem parent,IList<DesignItem> pastedItems) void AddInParent(DesignItem parent,IList<DesignItem> pastedItems)
{ {
IEnumerable<Rect> rects = pastedItems.Select(i => new Rect(new Point(0, 0), new Point((double)i.Properties["Width"].ValueOnInstance, (double)i.Properties["Height"].ValueOnInstance))); IEnumerable<Rect> rects = pastedItems.Select(i => new Rect(new Point(0, 0), new Point((double)i.Properties["Width"].ValueOnInstance, (double)i.Properties["Height"].ValueOnInstance)));
var operation = PlacementOperation.TryStartInsertNewComponents(parent, pastedItems, rects.ToList(), PlacementType.AddItem); var operation = PlacementOperation.TryStartInsertNewComponents(parent, pastedItems, rects.ToList(), PlacementType.PasteItem);
ISelectionService selection = _context.Services.Selection; ISelectionService selection = _context.Services.Selection;
selection.SetSelectedComponents(pastedItems); selection.SetSelectedComponents(pastedItems);
if(operation!=null) if(operation!=null)

6
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementType.cs

@ -35,6 +35,12 @@ namespace ICSharpCode.WpfDesign
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly PlacementType Delete = Register("Delete"); public static readonly PlacementType Delete = Register("Delete");
/// <summary>
/// Inserting from Cliboard
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly PlacementType PasteItem = Register("PasteItem");
readonly string name; readonly string name;
private PlacementType(string name) private PlacementType(string name)

Loading…
Cancel
Save