#1,058 – Translation Makes No Sense within Layout Transforms

layout transform is a transformation applied before a container’s child elements are laid out.

Because the container will position child elements after doing the layout transform, it doesn’t make sense to include a translation as part of a layout transform.  The container positions its child elements based on its layout rules, deciding on the X and Y position of each element after you’ve done the layout transform.

If you want to translate an element relative to where the container wants to put it, you can do that by using the Margin property of the element or by applying a render transform.

Below, the second label uses a translate transform that is ignored.  The third label does the translation in the render transform.

        <Label Content="Flavius" Background="AliceBlue"
        <Label Content="Lucius" Background="Bisque"
                <TranslateTransform X="100"/>
        <Label Content="Constantine" Background="Gainsboro"
                <TranslateTransform X="100"/>