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)
を使用して呼び出すと、ページをポップするときにアニメーションが実行されます。
あなたはAnimationPage代わりContentPageを作成https://github.com/AlexandrNikulin/AnimationNavigationPage素晴らしいライブラリ
使用
public class App : Application
{
public App()
{
MainPage = new AnimationNavigationPage(new YourHomePage());
}
}
を試してみて、ViewModelにから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
ページがポップアップするときに左にアニメーションが必要です。 UIViewControllerのPopViewControllerメソッドをオーバーライドしたナビゲーションページのレンダラーを作成しています。 PopViewController – Pratik