ViewExtensions.TranslateTo Method

Definition

Animates an elements TranslationX and TranslationY properties from their current values to the new values. This ensures that the input layout is in the same position as the visual layout.

public static System.Threading.Tasks.Task<bool> TranslateTo (this Xamarin.Forms.VisualElement view, double x, double y, uint length = 250, Xamarin.Forms.Easing easing = default);
static member TranslateTo : Xamarin.Forms.VisualElement * double * double * uint32 * Xamarin.Forms.Easing -> System.Threading.Tasks.Task<bool>

Parameters

view
VisualElement

The view to translate.

x
Double

The x component of the final translation vector.

y
Double

The y component of the final translation vector.

length
UInt32

The duration of the animation in milliseconds.

easing
Easing

The easing of the animation.

Returns

Remarks

To animate a view that receives user touch input from outside of the screen, the developer must first lay out the view in its final position, then translate the view off screen, and then finally animate the view back to its final position on the screen.

TranslateTo is useful for animations because it is applied post-layout. Translation animations will not conflict with managed layouts and thus are ideal for doing slide in/out style animations.

Applies to