TranslateTransform
TranslateTransform
TranslateTransform
TranslateTransform
Class
Definition
Translates (moves) an object in the two-dimensional x-y coordinate system.
public : sealed class TranslateTransform : Transform, ITranslateTransformpublic sealed class TranslateTransform : Transform, ITranslateTransformPublic NotInheritable Class TranslateTransform Inherits Transform Implements ITranslateTransform// This API is not available in Javascript.
<TranslateTransform .../>
- Inheritance
-
TranslateTransformTranslateTransformTranslateTransformTranslateTransform
- Attributes
Windows 10 requirements
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Inherited Members
Inherited methods
ClearValue(DependencyProperty)ClearValue(DependencyProperty)ClearValue(DependencyProperty)ClearValue(DependencyProperty)
GetAnimationBaseValue(DependencyProperty)GetAnimationBaseValue(DependencyProperty)GetAnimationBaseValue(DependencyProperty)GetAnimationBaseValue(DependencyProperty)
GetValue(DependencyProperty)GetValue(DependencyProperty)GetValue(DependencyProperty)GetValue(DependencyProperty)
ReadLocalValue(DependencyProperty)ReadLocalValue(DependencyProperty)ReadLocalValue(DependencyProperty)ReadLocalValue(DependencyProperty)
RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)
SetValue(DependencyProperty,Object)SetValue(DependencyProperty,Object)SetValue(DependencyProperty,Object)SetValue(DependencyProperty,Object)
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.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)Windows.UI.Xaml.Media.GeneralTransform.TryTransformCore(Windows.Foundation.Point,Windows.Foundation.Point)
Examples
This example uses a TranslateTransform to offset text. In this example, a slightly offset copy of text below the primary text creates a shadow effect.
<Canvas>
<!-- Offset the text using a TranslateTransform. -->
<TextBlock FontFamily="Verdana"
FontSize="32"
FontWeight="Bold"
Foreground="Black"
Text="Translated Text">
<TextBlock.RenderTransform>
<TranslateTransform X="2" Y="2" />
</TextBlock.RenderTransform>
</TextBlock>
<TextBlock FontFamily="Verdana"
FontSize="32"
FontWeight="Bold"
Foreground="Coral"
Text="Translated Text"/>
</Canvas>
<Canvas Width="200" Height="200">
<Rectangle PointerPressed="Rectangle_PointerPressed"
Width="50" Height="50"
Fill="RoyalBlue">
<Rectangle.RenderTransform>
<!-- If you give the transform a name
you can access it easily from code. -->
<TranslateTransform x:Name="myTranslateTransform" />
</Rectangle.RenderTransform>
</Rectangle>
</Canvas>
private void Rectangle_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
{
// Increase the X and Y properties.
myTranslateTransform.X = myTranslateTransform.X + 15;
myTranslateTransform.Y = myTranslateTransform.Y + 15;
}
Constructors
TranslateTransform() TranslateTransform() TranslateTransform() TranslateTransform()
Initializes a new instance of the TranslateTransform class.
public : TranslateTransform()public TranslateTransform()Public Sub New()// This API is not available in Javascript.
Properties
X X X X
Gets or sets the distance to translate along the x-axis.
public : double X { get; set; }public double X { get; set; }Public ReadWrite Property X As double// This API is not available in Javascript.
<TranslateTransform X="double"/>
- Value
- double double double double
The distance to translate (move) an object along the x-axis, in pixels. This property is read/write. The default is 0.
XProperty XProperty XProperty XProperty
Y Y Y Y
Gets or sets the distance to translate (move) an object along the y-axis.
public : double Y { get; set; }public double Y { get; set; }Public ReadWrite Property Y As double// This API is not available in Javascript.
<TranslateTransform Y="double"/>
- Value
- double double double double
The distance to translate (move) an object along the y-axis, in pixels. The default is 0.