private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e) { this.designerItem = DataContext as DesignerItem; if (this.designerItem != null) { this.designerCanvas = VisualHelper.FindAnchestor <DrawingLayer>(this.designerItem); } }
private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e) { this.designerItem = DataContext as DesignerItem; if (this.designerItem != null) { this.designerCanvas = VisualHelper.FindAnchestor <DrawingLayer>(this.designerItem) as DrawingLayer; AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this.designerCanvas); if (adornerLayer != null) { this.adorner = new SizeAdorner(this.designerItem); adornerLayer.Add(this.adorner); } } }
public RubberbandAdorner(DrawingLayer designerCanvas, Point?dragStartPoint) : base(designerCanvas) { this.designerCanvas = designerCanvas; this.startPoint = dragStartPoint; this.adornerCanvas = new Canvas(); this.adornerCanvas.Background = Brushes.Transparent; this.visuals = new VisualCollection(this); this.visuals.Add(this.adornerCanvas); this.rubberband = new Rectangle(); this.rubberband.Stroke = Brushes.Navy; this.rubberband.StrokeThickness = 1; this.rubberband.StrokeDashArray = new DoubleCollection(new double[] { 2 }); this.adornerCanvas.Children.Add(this.rubberband); }
protected override void OnPreviewMouseDown(MouseButtonEventArgs e) { base.OnPreviewMouseDown(e); DrawingLayer designer = VisualHelper.FindAnchestor <DrawingLayer>(this) as DrawingLayer; if (designer != null) { if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None) { this.IsSelected = !this.IsSelected; } else { if (!this.IsSelected) { designer.DeselectAll(); this.IsSelected = true; } } } e.Handled = false; }