ScaleTransform ScaleTransform ScaleTransform Class

Scales an object in the two-dimensional x-y coordinate system.

Syntax

Declaration

public sealed class ScaleTransformpublic sealed class ScaleTransformPublic NotInheritable Class ScaleTransform
<ScaleTransform .../>

Inheritance Hierarchy

Inherited Members

, , , , , , , , ,
Windows.UI.Xaml.Media.GeneralTransform.TryTransform(Windows.Foundation.Point,Windows.Foundation.Point)
Windows.UI.Xaml.Media.GeneralTransform.TryTransform(Windows.Foundation.Point,Windows.Foundation.Point)
Windows.UI.Xaml.Media.GeneralTransform.TryTransform(Windows.Foundation.Point,Windows.Foundation.Point)
, ,

Remarks

Examples

This XAML example uses a ScaleTransform to scale text from its original size.

<StackPanel>
    <TextBlock FontFamily="Verdana"
               FontSize="32"
               FontWeight="Bold" 
               Foreground="SteelBlue"
               Text="Scaled Text" />

    <!-- Scale the text width using a ScaleTransform. -->
    <TextBlock FontFamily="Verdana"
               FontSize="32"
               FontWeight="Bold"
               Foreground="SteelBlue"
               Text="Scaled Text">
        <TextBlock.RenderTransform>
            <ScaleTransform ScaleX="1.5" ScaleY="1.0" />
        </TextBlock.RenderTransform>
    </TextBlock>

    <!-- Scale the text height using a ScaleTransform. -->
    <TextBlock FontFamily="Verdana"
               FontSize="32"
               FontWeight="Bold" 
               Foreground="SteelBlue"
               Text="Scaled Text">
        <TextBlock.RenderTransform>
            <ScaleTransform ScaleX="1.0" ScaleY="1.5" />
        </TextBlock.RenderTransform>
    </TextBlock>
</StackPanel>
<StackPanel>
  <Rectangle PointerPressed="HandlePointerPressed"
    Width="50" Height="50" Fill="RoyalBlue">
    <Rectangle.RenderTransform>

      <!-- If you give the transform a name you can 
        access it easily from code. -->
      <ScaleTransform x:Name="myScaleTransform" />
    </Rectangle.RenderTransform>
  </Rectangle>
</StackPanel>
private void HandlePointerPressed(object sender, PointerRoutedEventArgs e)
{
    // Increase ScaleX and ScaleY by 25%.
    myScaleTransform.ScaleX = myScaleTransform.ScaleX * 1.25;
    myScaleTransform.ScaleY = myScaleTransform.ScaleY * 1.25;
}
Private Sub HandlePointerPressed(ByVal sender As Object, ByVal e As PointerRoutedEventArgs)
    ' Increase ScaleX and ScaleY by 25%.
    myScaleTransform.ScaleX = (myScaleTransform.ScaleX * 1.25)
    myScaleTransform.ScaleY = (myScaleTransform.ScaleY * 1.25)
End Sub

Constructors summary

Initializes a new instance of the ScaleTransform class.

Properties summary

Gets or sets the x-coordinate of the center point of this ScaleTransform.

Identifies the CenterX dependency property.

Gets or sets the y-coordinate of the center point of this ScaleTransform.

Identifies the CenterY dependency property.

Gets or sets the x-axis scale factor.

Identifies the ScaleX dependency property.

Gets or sets the y-axis scale factor.

Identifies the ScaleY dependency property.

Constructors

  • ScaleTransform()
    ScaleTransform()
    ScaleTransform()
    ScaleTransform()

    Initializes a new instance of the ScaleTransform class.

    public ScaleTransform()public ScaleTransform()Public Function ScaleTransform() As

Properties

  • CenterX
    CenterX
    CenterX
    CenterX

    Gets or sets the x-coordinate of the center point of this ScaleTransform.

    public double CenterX { get; set; }public double CenterX { get; set; }Public ReadWrite Property CenterX As double
    <ScaleTransform CenterX="double"/>
    

    Property Value

    • double
      double
      double

      The x-coordinate of the center point of this ScaleTransform. The default is 0.

  • CenterXProperty
    CenterXProperty
    CenterXProperty
    CenterXProperty

    Identifies the CenterX dependency property.

    public static DependencyProperty CenterXProperty { get; }public static DependencyProperty CenterXProperty { get; }Public Static ReadOnly Property CenterXProperty As DependencyProperty

    Property Value

  • CenterY
    CenterY
    CenterY
    CenterY

    Gets or sets the y-coordinate of the center point of this ScaleTransform.

    public double CenterY { get; set; }public double CenterY { get; set; }Public ReadWrite Property CenterY As double
    <ScaleTransform CenterY="double"/>
    

    Property Value

    • double
      double
      double

      The y-coordinate of the center point of this ScaleTransform. The default is 0.

  • CenterYProperty
    CenterYProperty
    CenterYProperty
    CenterYProperty

    Identifies the CenterY dependency property.

    public static DependencyProperty CenterYProperty { get; }public static DependencyProperty CenterYProperty { get; }Public Static ReadOnly Property CenterYProperty As DependencyProperty

    Property Value

  • ScaleX
    ScaleX
    ScaleX
    ScaleX

    Gets or sets the x-axis scale factor.

    public double ScaleX { get; set; }public double ScaleX { get; set; }Public ReadWrite Property ScaleX As double
    <ScaleTransform ScaleX="double"/>
    

    Property Value

    • double
      double
      double

      The scale factor along the x-axis. The default is 1.

  • ScaleXProperty
    ScaleXProperty
    ScaleXProperty
    ScaleXProperty

    Identifies the ScaleX dependency property.

    public static DependencyProperty ScaleXProperty { get; }public static DependencyProperty ScaleXProperty { get; }Public Static ReadOnly Property ScaleXProperty As DependencyProperty

    Property Value

  • ScaleY
    ScaleY
    ScaleY
    ScaleY

    Gets or sets the y-axis scale factor.

    public double ScaleY { get; set; }public double ScaleY { get; set; }Public ReadWrite Property ScaleY As double
    <ScaleTransform ScaleY="double"/>
    

    Property Value

    • double
      double
      double

      The scale factor along the y-axis. The default is 1.

  • ScaleYProperty
    ScaleYProperty
    ScaleYProperty
    ScaleYProperty

    Identifies the ScaleY dependency property.

    public static DependencyProperty ScaleYProperty { get; }public static DependencyProperty ScaleYProperty { get; }Public Static ReadOnly Property ScaleYProperty As DependencyProperty

    Property Value

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.UI.Xaml.Media.dll