Gets or sets a graphics transformation that should apply to this element when layout is performed.
Assembly: PresentationFramework (in PresentationFramework.dll)
In contrast to RenderTransform, will affect results of layout.
Setting a transform provides powerful capabilities of scaling and rotating. However, ignores TranslateTransform operations. This is because the layout system behavior for child elements of a FrameworkElement auto-corrects any offsets to the position of a scaled or rotated element into the layout and coordinate system of the parent element.
can lead to poor application performance if you invoke it in a scenario that does not require a full pass by the layout system. When you apply a to the Children collection of the Panel, it triggers a new pass by the layout system and forces all on-screen objects to be remeasured and rearranged. If you are updating the complete application user interface (UI), this functionality might be exactly what you need. However, if you do not need a full layout pass, use the RenderTransform property, which does not invoke the layout system, and therefore, is typically a better choice for this scenario.
Example scenarios where would be useful include: rotating elements such as menu components from horizontal to vertical or vice versa, scaling elements (zooming in) on focus, providing editing behavior, etc.
The following example shows how to apply a to an element. The example creates an instance of Button and hosts it within a parent Grid. It also uses the property to apply a RotateTransform to the Button.
Button btn2 = new Button(); btn2.Background = Brushes.LightCoral; btn2.Content = "RotateTransform"; btn2.LayoutTransform = new RotateTransform(45, 25, 25); Grid.SetRow(btn2, 0); Grid.SetColumn(btn2, 1); grid1.Children.Add(btn2);
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.