ScaleTransform ScaleTransform ScaleTransform ScaleTransform Class

Definition

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

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

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() ScaleTransform()

Initializes a new instance of the ScaleTransform class.

public : ScaleTransform()
public ScaleTransform()
Public Sub New()
var scaleTransform = new scaleTransform();

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
var double = scaleTransform.centerx;
scaleTransform.centerx = double;
<ScaleTransform CenterX="double"/>
Value
double 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
var dependencyProperty = Windows.UI.Xaml.Media.ScaleTransform.centerxProperty;
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the CenterX dependency property.

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
var double = scaleTransform.centery;
scaleTransform.centery = double;
<ScaleTransform CenterY="double"/>
Value
double 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
var dependencyProperty = Windows.UI.Xaml.Media.ScaleTransform.centeryProperty;
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the CenterY dependency property.

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
var double = scaleTransform.scalex;
scaleTransform.scalex = double;
<ScaleTransform ScaleX="double"/>
Value
double 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
var dependencyProperty = Windows.UI.Xaml.Media.ScaleTransform.scalexProperty;
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the ScaleX dependency property.

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
var double = scaleTransform.scaley;
scaleTransform.scaley = double;
<ScaleTransform ScaleY="double"/>
Value
double 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
var dependencyProperty = Windows.UI.Xaml.Media.ScaleTransform.scaleyProperty;
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the ScaleY dependency property.

Dispatcher Dispatcher Dispatcher Dispatcher

Inherited from DependencyObject

Inverse Inverse Inverse Inverse

Inherited from GeneralTransform

InverseCore InverseCore InverseCore InverseCore

Inherited from GeneralTransform

Methods

ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

Inherited from DependencyObject

GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty)

Inherited from DependencyObject

GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

Inherited from DependencyObject

ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

Inherited from DependencyObject

RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)

Inherited from DependencyObject

SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object)

Inherited from DependencyObject

TransformBounds(Rect) TransformBounds(Rect) TransformBounds(Rect) TransformBounds(Rect)

Inherited from GeneralTransform

TransformBoundsCore(Rect) TransformBoundsCore(Rect) TransformBoundsCore(Rect) TransformBoundsCore(Rect)

Inherited from GeneralTransform

TransformPoint(Point) TransformPoint(Point) TransformPoint(Point) TransformPoint(Point)

Inherited from GeneralTransform

UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64)

Inherited from DependencyObject

See Also