Browse Source

Move Inserted components by 10 Pixel

pull/692/head
jkuehner 10 years ago
parent
commit
dd6404c301
  1. 5
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs
  2. 20
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridPlacementSupport.cs
  3. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs

5
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs

@ -147,6 +147,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -147,6 +147,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
info.Item.Properties[FrameworkElement.HorizontalAlignmentProperty].Reset();
info.Item.Properties[FrameworkElement.VerticalAlignmentProperty].Reset();
info.Item.Properties[FrameworkElement.MarginProperty].Reset();
if (operation.Type == PlacementType.PasteItem) {
info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty).SetValue(((double)info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty).ValueOnInstance) + PlacementOperation.PasteOffset);
info.Item.Properties.GetAttachedProperty(Canvas.TopProperty).SetValue(((double)info.Item.Properties.GetAttachedProperty(Canvas.TopProperty).ValueOnInstance) + PlacementOperation.PasteOffset);
}
}
}

20
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridPlacementSupport.cs

@ -162,6 +162,26 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -162,6 +162,26 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
enteredIntoNewContainer=true;
grid.UpdateLayout();
base.EnterContainer(operation);
if (operation.Type == PlacementType.PasteItem) {
foreach (PlacementInformation info in operation.PlacedItems) {
var margin = (Thickness)info.Item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
var horizontalAlignment = (HorizontalAlignment)info.Item.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).ValueOnInstance;
var verticalAlignment = (VerticalAlignment)info.Item.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).ValueOnInstance;
if (horizontalAlignment == HorizontalAlignment.Left)
margin.Left += PlacementOperation.PasteOffset;
else if (horizontalAlignment == HorizontalAlignment.Right)
margin.Right -= PlacementOperation.PasteOffset;
if (verticalAlignment == VerticalAlignment.Top)
margin.Top += PlacementOperation.PasteOffset;
else if (verticalAlignment == VerticalAlignment.Bottom)
margin.Bottom -= PlacementOperation.PasteOffset;
info.Item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
}
}
}
GrayOutDesignerExceptActiveArea grayOut;

2
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs

@ -38,6 +38,8 @@ namespace ICSharpCode.WpfDesign @@ -38,6 +38,8 @@ namespace ICSharpCode.WpfDesign
IPlacementBehavior currentContainerBehavior;
bool isAborted, isCommitted;
public const double PasteOffset = 10;
#region Properties
/// <summary>
/// The items being placed.

Loading…
Cancel
Save