private void AdornedElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { dragging = true; if (!(AdornedElement.RenderTransform is TranslateTransform transform)) { transform = new TranslateTransform(); AdornedElement.RenderTransform = transform; } dragStartElementPosition = new Point(transform.X, transform.Y); dragStartMousePosition = e.GetPosition(null); AdornedElement.CaptureMouse(); e.Handled = true; OnDragStart?.Invoke(this, EventArgs.Empty); }