Browse Source

Posibility to Disable Snaplines via AttachedProperty

pull/593/head
jkuehner 11 years ago
parent
commit
a8bb555395
  1. 23
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs

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

@ -19,16 +19,11 @@ @@ -19,16 +19,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using ICSharpCode.WpfDesign.Extensions;
using System.ComponentModel;
using ICSharpCode.WpfDesign.Adorners;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Windows.Automation.Peers;
using System.Windows.Controls.Primitives;
using System.Diagnostics;
using System.Windows.Input;
@ -36,6 +31,20 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -36,6 +31,20 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
{
public class SnaplinePlacementBehavior : RasterPlacementBehavior
{
public static bool GetDisableSnaplines(DependencyObject obj)
{
return (bool)obj.GetValue(DisableSnaplinesProperty);
}
public static void SetDisableSnaplines(DependencyObject obj, bool value)
{
obj.SetValue(DisableSnaplinesProperty, value);
}
public static readonly DependencyProperty DisableSnaplinesProperty =
DependencyProperty.RegisterAttached("DisableSnaplines", typeof(bool), typeof(SnaplinePlacementBehavior), new PropertyMetadata(false));
AdornerPanel adornerPanel;
Canvas surface;
List<Snapline> horizontalMap;
@ -217,7 +226,8 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -217,7 +226,8 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
AddLines(containerRect, 0, false);
foreach (var item in AllDesignItems() /* ExtendedItem.ContentProperty.CollectionElements */
.Except(operation.PlacedItems.Select(f => f.Item))) {
.Except(operation.PlacedItems.Select(f => f.Item))
.Where(x=>!GetDisableSnaplines(x.View))) {
if (item != null) {
var bounds = GetPosition(operation, item);
@ -376,4 +386,3 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -376,4 +386,3 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
}
}
}
Loading…
Cancel
Save