At this point, you should have a good understanding of the various shapes, colors, and brushes you can use in Windows Phone 7 applications. Next you will see how to make use of various transform effects like rotation, scaling, skewing, and translation.
You can rotate just about any Silverlight object without having to create complicated rotation algorithms. Instead, Silverlight provides the RotateTransform object, which you can easily apply to various controls and shapes to rotate them a specified number of degrees.
You use the RotateTransform object in XAML as follows:
<TextBlock x:Name=“RotatedText”Margin=“50”Text=“This text has been rotated”> <TextBlock.RenderTransform> <RotateTransform Angle=“45”/> </TextBlock.RenderTransform> </TextBlock>
This seems simple enough. Basically, in this example, you rotate a TextBlock object 45 degrees by adding a RotateTransform object with the Angle property set to the RenderTransform property of the TextBlock control. To better understand how this works, first take a look at the RenderTransform property of the TextBlock object. All Silverlight controls contain an attached property called RenderTransform that enables you to specify a type of transform to apply during the rendering of the object. In this case, you add a simple rotation to the text. You can't ask for an easier way to rotate an object than this. Figure 3-15 shows the rotation in action.