Exemple #1
0
        private void AdornedElement_MouseMove(object sender, MouseEventArgs e)
        {
            if (dragging)
            {
                Point mousePosition = e.GetPosition(null);

                Vector offset = mousePosition - dragStartMousePosition;

                TranslateTransform transform = AdornedElement.RenderTransform as TranslateTransform;

                transform.X = dragStartElementPosition.X + offset.X;
                transform.Y = dragStartElementPosition.Y + offset.Y;

                transform.X -= transform.X % CellSize;
                transform.Y -= transform.Y % CellSize;

                AdornedElement.InvalidateVisual();
            }
        }