Add Rotate capability

Aug 24, 2010 at 5:47 AM

I added RotateTransform into transformGroup, rotation work fine when I provide an angle to the control.

The problem now is once i rotate from 0 degree, panning direction is not according to mouse move direction.

Anybody successfully implement rotate capability without impact to panning?




Aug 24, 2010 at 12:36 PM

Can you post some sample code of what you already have and that doesn't work?


You may have to do a compound transform. This would involve doing a transform, rotation, then another transform. Hard to say though without some sample code.

Aug 25, 2010 at 2:18 AM
Thanks for the respond.
You means i need undo the rotation, do any others transform and lastly rotation again?
See below for the lines of code that i added.
rotateClockwiseBinding_Executed is called from a command.

private RotateTransform _rotateTransform;
protected ZoomContentPresenter Presenter
            get { return _presenter; }
                _presenter = value;
                if (_presenter == null)

                //add the ScaleTransform to the presenter
                _transformGroup = new TransformGroup();
                _scaleTransform = new ScaleTransform();
                _translateTransform = new TranslateTransform();
                _rotateTransform = new RotateTransform();
                _presenter.RenderTransform = _transformGroup;
                _presenter.RenderTransformOrigin = new Point(0.5, 0.5);


        private static void rotateClockwiseBinding_Executed(object sender, ExecutedRoutedEventArgs e)
          var zc = (ZoomControl)sender;
          if (zc._rotateTransform == null)

          zc._rotateTransform.Angle += 45;


Aug 25, 2010 at 3:29 AM

I'm a little rusty on my transforms, but I think you want to apply the rotate before the transform.

Aug 26, 2010 at 6:56 AM

It work after i give the rotate before other transform.

But i didn't really apply that way, instead, I figure out that i actually can give the rotateTransform to the content of the zoom control, so alway the content being rotate, but not the contentpresenter.

It should not give any different, i think.

thanks a lot for your comment and respond.. :-


Nov 19, 2012 at 6:22 AM


I m also facing same Problem. After Rotate the Canvas, I m not able to actual coordinate to do zoom on that point.


Hey hmlim, do you get any solution?