Esempio n. 1
0
        private void SnappedEdgesOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
        {
            if (notifyCollectionChangedEventArgs.Action == NotifyCollectionChangedAction.Remove)
            {
                foreach (Edge removedEdge in notifyCollectionChangedEventArgs.OldItems)
                {
                    var adorner = EdgeAdorners[removedEdge];
                    DesignSurface.RemoveAdorner(adorner);
                    EdgeAdorners.Remove(removedEdge);
                }
            }
            if (notifyCollectionChangedEventArgs.Action == NotifyCollectionChangedAction.Add)
            {
                foreach (Edge addedEdge in notifyCollectionChangedEventArgs.NewItems)
                {
                    var edgeAdorner = ServiceLocator.UIElementFactory.CreateEdgeAdorner(DesignSurface, WrappedSelectedItems, addedEdge);
                    EdgeAdorners.Add(addedEdge, edgeAdorner);
                    DesignSurface.AddAdorner(edgeAdorner);
                }
            }
            if (notifyCollectionChangedEventArgs.Action == NotifyCollectionChangedAction.Reset)
            {
                foreach (var adorner in EdgeAdorners.Values)
                {
                    DesignSurface.RemoveAdorner(adorner);
                }

                EdgeAdorners.Clear();
            }
        }
Esempio n. 2
0
        private void RemoveSelectionAdorner(ICanvasItem container)
        {
            var adorner = SelectionAdorners[container];

            SelectionAdorners.Remove(container);
            DesignSurface.RemoveAdorner(adorner);
        }