The layout system lies have become a bit more elaborate [LayoutTransform functionality updated and enhanced for Silverlight 2 Beta 2!]

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of

See you there!

Comments (13)
  1. Michael Washington on prompting for install, Peter McGrattan updated his Stock List Demo, Joel Neubeck

  2. says:

    So, I’ve got what amounts to a design surface with several different elements that can be moved around and rotated. I use some simple math to make sure that they cannot be drug outside the bounds of the design surface.  I was thinking of using your LayoutTransformControl to make sure that the bounds checking wouldn’t get messed up when the controls were rotated.

    Can you offer any advice on how the layout control might be used in this way? The controls are already built on a UserControl with a Grid inside to keep the child controls organized. I’ve tried wrapping the LayoutRoot Grid in the LayoutTransformControl, but it seems to be suppressing my VisualStateManger.GoToState calls that I use to indicate a mouse hover or click. Any thoughts?


  3. David Anson says:


    LayoutTransformControl is intended to wrap a single item and give that item the ability to transform as if during the layout pass. As such, I’m not sure wrapping your outer Grid in a LayoutTransformControl would accomplish what I understand your goal to be. What I would expect (without understanding the details of your approach) is that you would wrap the individual elements within the bounds of your layout system in LayoutTransformControl and do their rotations via LayoutTransformControl.Transform/RotateTransform. This should mean that the bounds reported by LayoutTransformControl.RenderSize will accurately reflect the transformation and you (or perhaps the layout system) can then decided if they need to be repositioned further.

    Hope this helps!

  4. says:

    Ok, I actually had to write a small wrapper to make it easier to manage a collection of LayoutTransformControl’s and still be able to access the functionality of the underlying UserControl. However, I think I’m misunderstanding how transforms work. I can’t seem to get the transforms to work programatically.

    Shouldn’t something like the following work?

           Dim rot As New LayoutTransformControlSample.LtcRotateTransform

           rot.Angle = 90

           Dim tg As New TransformGroup


           ActiveControl.Transform = tg

  5. David Anson says:


    Yes, I would expect the scenario to work. To check for myself, I created a new test project – and things seem to work properly. Here’s the XAML and code for it – when the button is clicked, the new text shows up rotated. Hope this helps!

    <UserControl x:Class="LTCinCode.Page"



       <StackPanel x:Name="LayoutRoot">

           <Button Content="Click me to add some rotated text!" Click="Button_Click"/>



    using System.Windows;

    using System.Windows.Controls;

    using LayoutTransformControlSample;

    namespace LTCinCode


       public partial class Page : UserControl


           public Page()




           private void Button_Click(object sender, RoutedEventArgs e)


               var ltc = new LayoutTransformControl();

               ltc.Transform = new LtcRotateTransform { Angle = 45 };

               ltc.Child = new TextBlock { Text = "Hello world." };





  6. says:

    It turns out that I was making it more complicated than it needed to be, and my wrapper wasn’t allowing good enough access to the LayoutTransformControl.

    After some further fiddling with it, everything is working great. Thank you very much for your help!

  7. NinetiesGuy says:

    Is there a way to have the LayoutTransformControl respect the CenterX and CenterY ScaleTransform properties? In my scenario, I have a large Image control nested in a ScrollViewer. The layout control is the only way I have found for the scroll bars to update based on content scale, but when I use the scale transform (standard or Ltc), the image is always scaled from the top left, ignoring any attempts to set a registration point. The same behavior occurs when using a MatrixTransform (standard or Ltc).

    Thanks in advance,


  8. David Anson says:


    I note in the third bullet point above that it’s my understanding that CenterX/CenterY do not have any effect when used with LayoutTransform on WPF (and as I recall, this is backed up by my reading of the code). To demonstrate my point, here’s a simple XAML demonstration – I find that changes to the values of CenterX/CenterY seem to have no visual effect:

    <Button Content="Button" HorizontalAlignment="Center" VerticalAlignment="Center">


       <ScaleTransform ScaleX="5" CenterX="-100" CenterY="100"/>



    If you have a counterexample that you can share, I’d love to come to an understanding here!

  9. Delay's Blog says:

    In the introductory post for LayoutTransformControl and the feature-enhancing follow-up , I gave a variety

  10. Delay's Blog says:

    I’d almost finished patting myself on the back for managing to implement WPF’s LayoutTransform on Silverlight

  11. Delay's Blog says:

    When I first wrote about adding full LayoutTransform fidelity to Silverlight with my LayoutTransformControl

  12. Delay's Blog says:

    I’m a believer in the power of LayoutTransform – so much so that I wrote a control to graft this capability

  13. Delay's Blog says:

    I came across a question on the Silverlight Toolkit support forum yesterday asking how to animate the

Comments are closed.

Skip to main content