blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

andyBlog [andy britcliffe]

My working life in an internet nutshell

Silverlight 1.0: Applying a Render transform dynamically

Here is an interesting one. Typically with the Silverlight 1.0 object model you can access properties and methods directly through Javascript. Now given this you would expect that to dynamically set a Transform, for example a rotation on a TextBlock, you would do something along the lines of textblock.RenderTransform.TransformGroup.RotateTransform.Angle="45" or something to that effect. However this will error. To do this you actually have to create the Transform from XAML using the createFromXAML method.

So to add RotateTransform to a TextBlock you need to do the following:

var textblock = rootCanvas.findName('tb');
var trans = control.content.createFromXaml('<TransformGroup><RotateTransform Angle=\"45\"/></TransformGroup>');
textblock.renderTransform = trans;

and that will dynamically add the rotation to the TextBlock.

Published 27 September 2007 11:57 by Andrew.Britcliffe
Filed under:

Comments

 

andyBlog said:

Here is an interesting one. Typically with the Silverlight 1.0 object model you can access properties...

September 27, 2007 12:01
 

WynApse said:

Silverlight Cream for October 1, 2007

October 1, 2007 17:27
Anonymous comments are disabled

About Andrew.Britcliffe

Senior Technical Consultant.
Powered by Community Server (Personal Edition), by Telligent Systems