private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e)
        {
            this.element = DataContext as BaseObject;

            if (this.element != null)
            {
                this.canvasWorkspace = VisualTreeHelper.GetParent(this.element) as CanvasWorkspace;
            }
        }
Example #2
0
        public RubberbandAdorner(CanvasWorkspace canvasWorkspace, Point?dragStartPoint)
            : base(canvasWorkspace)
        {
            this.canvasWorkspace = canvasWorkspace;
            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);
        }
Example #3
0
        protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
        {
            base.OnPreviewMouseDown(e);
            CanvasWorkspace canvasWorkspace = VisualTreeHelper.GetParent(this) as CanvasWorkspace;

            if (canvasWorkspace != null)
            {
                if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
                {
                    this.IsSelected = !this.IsSelected;
                }
                else
                {
                    if (!this.IsSelected)
                    {
                        canvasWorkspace.DeselectAll();
                        this.IsSelected = true;
                    }
                }
            }

            e.Handled = false;
        }