CompositeTransform simplifies transforms in Silverlight 4 Beta

One of the features you may have missed that was added to the Silverlight 4 beta is the new CompositeTransform class. The new class provides a simpler way to transform an element, by simply offering a single object to instantiate rather than a group of transforms made for specific transforms. To animate properties, you will no longer need to name multiple Transforms or access them by index (hoping they were added in the expected order).

Not only is the code easier to write and less characters, but property access is clearer.  To rotate an object you change the Rotation property rather than the RotationTransform.Angle property. I think the simplicity of property access is demonstrated best by the C# example below.

XAML example

C# example

You will notice that the new Expression Blend for .NET 4 Preview still defaults to the verbose TransformGroup, but it will render the CompositeTransform without complaints.

For more information on the Silverlight 4 Beta, check out the Technical Feature Overview for Silverlight 4.

4 thoughts on “CompositeTransform simplifies transforms in Silverlight 4 Beta

Leave a Reply