SIGN UP MEMBER LOGIN:    
ARTICLE

Using Transforms with Expression Blend

Posted by Mamta M Articles | Expression Studio November 16, 2011
In this article you will learn how can easily reposition, resize, scale, rotate and skew your objects in Expression Blend.
Reader Level:

Using Microsoft Expression Blend, you can easily reposition, resize, scale, rotate and skew your objects. You can achieve this by making changes on the artboard at design time or by changing the properties in the Layout and Transform categories of the Properties panel.

For a WPF or Silverlight application, Microsoft Expression Blend supports the following types of transformations:

  • Translate
  • Rotate
  • Scale
  • Skew
  • Center Point
  • Flip

Translate: Enables you to reposition an object by providing X and Y values.

Rotate: Enables you to rotate an object by specifying an angle.

Scale: Enables you to scale or resize an object by providing X and Y values.

Skew: Enables you to skew an object by providing X and Y values.

Center Point: Enables you to provide a new center point for the object by specifying X and Y values.

Flip: Enables you to flip an object by its x axis or y axis.

Note: The first four transforms map to transform classes in the System.Windows.Media namespace. You can read about them here on the MSDN library.

To implement these transforms, let us create a WPF application using Microsoft Expression Blend. Name the application as WpfTransforms. Figure 1 shows the creation of the application.

Transforms in ExpressionBlend

Figure 1

Add an image control to the artboard using the Assets pane (Window -Assets) and set its Source property to Sunset.jpg. This image is freely available in the Sample Pictures folder of your machine, provided you use a Windows OS. Figure 2 shows the image added to the artboard.

Transforms

Figure 2

Click Window -Objects and Timeline and click the + symbol to create a new Storyboard.

Expression Blend

Figure 3

In the new Storyboard, while the storyboard is in recording mode, move the keyframe from 0 to 1, click the Image and then open the properties window using Window-Properties.
Scroll down in the properties window till you come to the Transform section. Figure 4 shows how the Transform section looks like.

Transforms

Figure 4

In this section, you can choose the various types of transforms that can be applied to your object. Figure 5 shows the transform type represented by each icon.

 Expression Blend transformation

Figure 5

Click Translate and specify 15 and 15 for the X and Y values respectively. This will reposition or move the Image by 15 in X direction and 15 in Y direction.

Move the keyframe from 1 to 2 seconds and select Rotate transform. Specify the Angle as 20. This will rotate the image by 20 degrees.

Then move the keyframe from 2 to 3 seconds and select Scale transform. Specify the X and Y values as 1.5 and 1 respectively. This will resize the image by the specified values.

Again, move the keyframe from 3 to 4 seconds and select Skew transform. Specify the X and Y values as 2 and 4 respectively. This will skew the image by the specified values.

Move the keyframe from 4 to 5 seconds and select Center Point transform. Specify the X and Y values as 0.5 and 0.5 respectively. This will change the center point of the image to the specified value.

Finally, move the keyframe from 5 to 6 seconds select Flip transform and select Flip X axis. This will flip the image horizontally.

Click Close Storyboard on the Objects and Timeline section.

Build and execute the application.

Conclusion: Thus, you saw different kinds of transforms and how to use them in Expression Blend.

Login to add your contents and source code to this article
share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Gauge for SharePoint
Become a Sponsor