First, in your page
private readonly ScreenMetrics _metrics;
private readonly int _formsWidth;
private readonly int _formsHeight;
public MainPage()
{
InitializeComponent();
//calculate screen size, to use in animations
_metrics = DeviceDisplay.ScreenMetrics;
_formsWidth = Convert.ToInt32(_metrics.Width / _metrics.Density);
_formsHeight = Convert.ToInt32(_metrics.Height / _metrics.Density);
}
In OnAppearing, translate the elements you want outside the screen
protected override async void OnAppearing()
{
base.OnAppearing();
await Task.WhenAll(
//translate to the left side of the device, negative
YourViewLeftSide.TranslateTo(_formsWidth, 0, 0, null),
//translate to the right side of the device, negative
YourViewRightSide.TranslateTo(-_formsWidth, 0, 0, null)
);
}
On the button that animates left view
async void OnButton1Clicked(object sender, EventArgs args)
{
//animate left side
YourViewLeftSide.TranslateTo(0, 0, 400, Easing.CubicInOut),
}
On the button that animates right view
async void OnButton2Clicked(object sender, EventArgs args)
{
//animate right side
YourViewRightSide.TranslateTo(0, 0, 400, Easing.CubicInOut),
}
Now you can adapt and customize to your needs!
TabbedRenderercan do that.(docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/…) - Junior Jiang