public DesignAidsProvider(DesignSurface designSurface)
        {
            DesignSurface = designSurface;
            DesignSurface.Loaded += DesignSurfaceOnLoaded;

            SelectionAdorners = new Dictionary<ICanvasItem, SelectionAdorner>();

            EdgeAdorners = new Dictionary<Edge, EdgeAdorner>();

            PlaneOperation = PlaneOperation.Resize;
            DragOperationHost = new DragOperationHost(DesignSurface);
            DragOperationHost.DragStarted += DragOperationHostOnDragStarted;
            DragOperationHost.DragEnd += DragOperationHostOnDragEnd;

            SnappingEngine = new CanvasItemSnappingEngine(4);
            var snappedEdges = SnappingEngine.SnappedEdges;
            ((INotifyCollectionChanged)snappedEdges).CollectionChanged += SnappedEdgesOnCollectionChanged;

            DragOperationHost.SnappingEngine = SnappingEngine;
        }
Example #2
0
        public void MyTestMethod()
        {
            var snappingEngine = new CanvasItemSnappingEngine(8);
            var canvasItems = new List<CanvasItem>
                              {
                                  new CanvasModelItem
                                  {
                                      Left = 10,
                                      Top = 10,
                                      Height = 20,
                                      Width = 20,
                                  },
                                  new CanvasModelItem
                                  {
                                      Left = 33,
                                      Top = 10,
                                      Height = 20,
                                      Width = 20,
                                  }
                              };

            snappingEngine.Magnets = canvasItems;
        }