Scale​Transform Scale​Transform Scale​Transform Class

Definition

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

public : sealed class ScaleTransform : Transform, IScaleTransformpublic sealed class ScaleTransform : Transform, IScaleTransformPublic NotInheritable Class ScaleTransform Inherits Transform Implements IScaleTransform
<ScaleTransform .../>
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

Inherited properties

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)
Windows.UI.Xaml.Media.GeneralTransform.TryTransformCore(Windows.Foundation.Point,Windows.Foundation.Point)Windows.UI.Xaml.Media.GeneralTransform.TryTransformCore(Windows.Foundation.Point,Windows.Foundation.Point)Windows.UI.Xaml.Media.GeneralTransform.TryTransformCore(Windows.Foundation.Point,Windows.Foundation.Point)

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

ScaleTransform() ScaleTransform() ScaleTransform()

Initializes a new instance of the ScaleTransform class.

public : ScaleTransform()public ScaleTransform()Public Sub New()
Attributes

Properties

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"/>
Value
double double double

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

Attributes

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
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the CenterX dependency property.

Attributes

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"/>
Value
double double double

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

Attributes

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
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the CenterY dependency property.

Attributes

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"/>
Value
double double double

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

Attributes

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
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ScaleX dependency property.

Attributes

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"/>
Value
double double double

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

Attributes

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
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ScaleY dependency property.

Attributes

See Also