public DesignSurfaceCommandHandler(IDesignSurface designSurface, UIElement uiElement)
        {
            DesignSurface = designSurface;
            UIElement     = uiElement;

            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.GroupCommand, Group, CanGroupSelection));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.PromoteChildrenCommand, Ungroup, CanUngroup));

            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignHorizontallyLeftCommand,
                                                             (sender, args) => AlignHorizontally(HorizontalAlignment.Left), CanExecuteAlignCommandHandler));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignHorizontallyCenterCommand,
                                                             (sender, args) => AlignHorizontally(HorizontalAlignment.Center), CanExecuteAlignCommandHandler));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignHorizontallyRightCommand,
                                                             (sender, args) => AlignHorizontally(HorizontalAlignment.Right), CanExecuteAlignCommandHandler));

            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignVerticallyTopCommand,
                                                             (sender, args) => AlignVertically(VerticalAlignment.Top), CanExecuteAlignCommandHandler));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignVerticallyCenterCommand,
                                                             (sender, args) => AlignVertically(VerticalAlignment.Center), CanExecuteAlignCommandHandler));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignVerticallyBottomCommand,
                                                             (sender, args) => AlignVertically(VerticalAlignment.Bottom), CanExecuteAlignCommandHandler));

            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.BringToFrontCommand,
                                                             (sender, args) => BringToFront(), IsSomethingSelectedCommandHandler));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.SendToBackCommand,
                                                             (sender, args) => SendToBack(), IsSomethingSelectedCommandHandler));
        }
        public DesignSurfaceCommandHandler(IDesignSurface designSurface, UIElement uiElement)
        {
            DesignSurface = designSurface;
            UIElement = uiElement;

            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.GroupCommand, Group, CanGroupSelection));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.PromoteChildrenCommand, Ungroup, CanUngroup));

            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignHorizontallyLeftCommand,
                (sender, args) => AlignHorizontally(HorizontalAlignment.Left), CanExecuteAlignCommandHandler));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignHorizontallyCenterCommand,
                (sender, args) => AlignHorizontally(HorizontalAlignment.Center), CanExecuteAlignCommandHandler));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignHorizontallyRightCommand,
                (sender, args) => AlignHorizontally(HorizontalAlignment.Right), CanExecuteAlignCommandHandler));

            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignVerticallyTopCommand,
                (sender, args) => AlignVertically(VerticalAlignment.Top), CanExecuteAlignCommandHandler));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignVerticallyCenterCommand,
                (sender, args) => AlignVertically(VerticalAlignment.Center), CanExecuteAlignCommandHandler));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.AlignVerticallyBottomCommand,
                (sender, args) => AlignVertically(VerticalAlignment.Bottom), CanExecuteAlignCommandHandler));

            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.BringToFrontCommand,
                (sender, args) => BringToFront(), IsSomethingSelectedCommandHandler));
            UIElement.CommandBindings.Add(new CommandBinding(DesignSurfaceCommands.SendToBackCommand,
               (sender, args) => SendToBack(), IsSomethingSelectedCommandHandler));
        }
 public IAdorner CreateSelectionAdorner(IDesignSurface designSurface, ICanvasItem canvasItem)
 {
     return(new SelectionAdorner(designSurface, canvasItem)
     {
         IsHitTestVisible = false
     });
 }
        public DesignAidsProvider(IDesignSurface designSurface)
        {
            DesignSurface = designSurface;


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

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

            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;
        }
Ejemplo n.º 5
0
        public DesignAidsProvider(IDesignSurface designSurface)
        {
            DesignSurface = designSurface;


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

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

            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;
        }
Ejemplo n.º 6
0
 public IAdorner CreateSelectionAdorner(IDesignSurface designSurface, ICanvasItem canvasItem)
 {
     return(new DesignSurface.VisualAids.Selection.SelectionAdorner(designSurface, canvasItem));
 }
Ejemplo n.º 7
0
 public SchematicDiagram(IDesignSurface designSurface)
 {
 }
 public IAdorner CreateSelectionAdorner(IDesignSurface designSurface, ICanvasItem canvasItem)
 {
    return new DesignSurface.VisualAids.Selection.SelectionAdorner(designSurface, canvasItem);
 }
 public IAdorner CreateSelectionAdorner(IDesignSurface designSurface, ICanvasItem canvasItem)
 {
     return new SelectionAdorner(designSurface, canvasItem) { IsHitTestVisible = false };
 }