2017-05-08 60 views

回答

0

PopAsync有一個override接受一個布爾值來表明它是否應該動畫。如果您使用Navigation.PopAsync(true)調用它,它將在彈出頁面時執行動畫。

+0

我想在頁面彈出時右邊的動畫。我已經使ios中的導航頁面的渲染器,其中我已覆蓋UIViewController的PopViewController方法。不調用PopViewController – Pratik

0

您可以嘗試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 }; 
} 
+0

沒有使用組件的任何解決方案。 – Pratik