請告訴我如何在調用PopAsync()時應用從右到左來的動畫頁面效果。如何從右向左使用PopAsync頁面導航動畫?
我的代碼:
async void LogOut_Tapped(object sender, EventArgs e)
{
await Navigation.PopAsync();
}
請幫助我。
請告訴我如何在調用PopAsync()時應用從右到左來的動畫頁面效果。如何從右向左使用PopAsync頁面導航動畫?
我的代碼:
async void LogOut_Tapped(object sender, EventArgs e)
{
await Navigation.PopAsync();
}
請幫助我。
PopAsync
有一個override接受一個布爾值來表明它是否應該動畫。如果您使用Navigation.PopAsync(true)
調用它,它將在彈出頁面時執行動畫。
您可以嘗試https://github.com/AlexandrNikulin/AnimationNavigationPage驚人庫
使用
public class App : Application
{
public App()
{
MainPage = new AnimationNavigationPage(new YourHomePage());
}
}
創建AnimationPage代替ContentPage並從視圖模型XAML或綁定創建FadePageAnimation或PushPageAnimation或FlipPageAnimation等的實例。
<?xml version="1.0" encoding="UTF-8"?>
<controls:AnimationPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:FormsControls.Base;assembly=FormsControls.Base"
x:Class="Sample.FadeAnimationPage"
Title="Fade Animation">
<controls:AnimationPage.PageAnimation>
<controls:FadePageAnimation />
</controls:AnimationPage.PageAnimation>
</controls:AnimationPage>
或實現ContentPage的接口IAnimationPage。創建EmptyPageAnimation或DefaultPageAnimation或FlipPageAnimation等的實例...
public partial class FirstPage : ContentPage, IAnimationPage
{
public FirstPage()
{
InitializeComponent();
}
public IPageAnimation PageAnimation { get; } = new FlipPageAnimation { Duration = 650, Subtype = AnimationSubtype.FromLeft };
}
沒有使用組件的任何解決方案。 – Pratik
我想在頁面彈出時右邊的動畫。我已經使ios中的導航頁面的渲染器,其中我已覆蓋UIViewController的PopViewController方法。不調用PopViewController – Pratik