# WPF: How to repeat rotate transform

**URL:** <https://forum.kirupa.com/t/wpf-how-to-repeat-rotate-transform/282059>\
**Category:** programming\
**Created:** [February 17, 2009, 6:57am UTC](https://forum.kirupa.com/t/wpf-how-to-repeat-rotate-transform/282059 "2009-02-17T06:57:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![psychman](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@psychman](https://forum.kirupa.com/u/psychman)\
**Post date:** [February 17, 2009, 6:57am UTC](https://forum.kirupa.com/t/wpf-how-to-repeat-rotate-transform/282059/1 "2009-02-17T06:57:35Z")

</div>

Hello. I have created a context menu with two options, rotate image 90 degrees clockwise and rotate image 90 degrees counterclockwise. The method I am using to rotate works the first time, but will not continue to rotate the object, in the same direction, on subsequent tries. I want the user to be able to rotate the image in 90 degree increments until the image has gone around 360 degrees, if need be. Here is what I have tried:

private void RotateCW (object sender, RoutedEventArgs e)  
{  
RotateTransform cwRotateTransform = new RotateTransform(); View2.RenderTransform = cwRotateTransform;  
if (cwRotateTransform.Angle == 360)  
cwRotateTransform.Angle=0;  
else cwRotateTransform.Angle +=90;  
}

Thanks in advance for any help on this.
