Browse Source

Possibility to disable Snaplines in a Derived Extension via returning CanPlace = false

pull/604/head
jkuehner 12 years ago
parent
commit
cf41d83966
  1. 7
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultPlacementBehavior.cs
  2. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs
  3. 7
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/RootItemBehavior.cs
  4. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementBehavior.cs

7
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultPlacementBehavior.cs

@ -50,7 +50,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -50,7 +50,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
ExtendedItem.AddBehavior(typeof(IPlacementBehavior), this);
}
public virtual bool CanPlace(ICollection<DesignItem> childItems, PlacementType type, PlacementAlignment position)
public virtual bool CanPlace(IEnumerable<DesignItem> childItems, PlacementType type, PlacementAlignment position)
{
return true;
}
@ -80,6 +80,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -80,6 +80,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
{
}
public virtual bool CanPlaceItem(PlacementInformation info)
{
return true;
}
public virtual void SetPosition(PlacementInformation info)
{
if (info.Operation.Type != PlacementType.Move)

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs

@ -225,6 +225,9 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -225,6 +225,9 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
AddLines(containerRect, 0, false);
if (!CanPlace(operation.PlacedItems.Select(x => x.Item), operation.Type, PlacementAlignment.Center))
return;
foreach (var item in AllDesignItems() /* ExtendedItem.ContentProperty.CollectionElements */
.Except(operation.PlacedItems.Select(f => f.Item))
.Where(x=> x.View != null && !GetDisableSnaplines(x.View))) {

7
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/RootItemBehavior.cs

@ -38,12 +38,9 @@ namespace ICSharpCode.WpfDesign.Designer @@ -38,12 +38,9 @@ namespace ICSharpCode.WpfDesign.Designer
_rootItem.AddBehavior(typeof(IRootPlacementBehavior),this);
}
public bool CanPlace(System.Collections.Generic.ICollection<DesignItem> childItems, PlacementType type, PlacementAlignment position)
public bool CanPlace(IEnumerable<DesignItem> childItems, PlacementType type, PlacementAlignment position)
{
return type == PlacementType.Resize &&
(position == PlacementAlignment.Right
|| position == PlacementAlignment.BottomRight
|| position == PlacementAlignment.Bottom);
return type == PlacementType.Resize && (position == PlacementAlignment.Right || position == PlacementAlignment.BottomRight || position == PlacementAlignment.Bottom);
}
public void BeginPlacement(PlacementOperation operation)

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

@ -31,7 +31,7 @@ namespace ICSharpCode.WpfDesign @@ -31,7 +31,7 @@ namespace ICSharpCode.WpfDesign
/// <summary>
/// Gets if the child element can be resized.
/// </summary>
bool CanPlace(ICollection<DesignItem> childItems, PlacementType type, PlacementAlignment position);
bool CanPlace(IEnumerable<DesignItem> childItems, PlacementType type, PlacementAlignment position);
/// <summary>
/// Starts placement mode for this container.

Loading…
Cancel
Save