public async Task PushViewAsync(NavigatableView view, DefaultAnimationBehavior defaultAnimation, bool animateIn = true, bool animateOut = false, Animation otherAnimations = null) { // Add to stack ViewStack.Add(view); view.Parent = this; // Initialize the position if (animateIn) { view.InitializeDefaultTransitionPosition(defaultAnimation); } // Change the content view whenever the stack changes (always show the top one) ContentGrid.Children.Add(view); await AnimateTransitioning.DefaultTransitioning( view, defaultAnimation, true, animateIn || animateOut || otherAnimations != null, (animateOut)?PreviousView : null, otherAnimations); CurrentView.Appeared = true; if (PreviousView != null) { PreviousView.Appeared = false; } }
public ViewContainer(NavigatableView InitialView) : base() { InitializeComponent(); ItemSource = new ObservableRangeCollection <NavigatableView>(); ViewStack = new ObservableRangeCollection <NavigatableView>(); ItemSource.CollectionChanged += ItemSource_CollectionChanged; ViewStack.CollectionChanged += ViewStack_CollectionChanged; PushViewAsync(InitialView); }
public async Task SwitchView(NavigatableView view, DefaultAnimationBehavior defaultAnimation, bool animateIn = false, bool animateOut = false, Animation otherAnimations = null) { // Remove from existing stack and grid ContentGrid.Children.Remove(view); ViewStack.Remove(view); // push a new one await PushViewAsync(view, defaultAnimation, animateIn, animateOut, otherAnimations); }
public Task InsertView(NavigatableView view, int index) { return(Task.Run(() => { ViewStack.Insert(index, view); ContentGrid.Dispatcher.BeginInvokeOnMainThread(() => { ContentGrid.Children.Insert(index, view); }); CurrentView.Appeared = true; if (PreviousView != null) { PreviousView.Appeared = false; } })); }
public async Task PushViewAsync(NavigatableView view, bool animateIn = true, bool animateOut = false, Animation otherAnimations = null) { // Add to stack ViewStack.Add(view); view.Parent = this; // Initialize the position if (animateIn) { view.InitializePosition(); } // Change the content view whenever the stack changes (always show the top one) ContentGrid.Children.Add(view); // Animate transition await AnimateTransitioning.CustomTransitioning(CurrentView, PreviousView, true, animateIn, animateOut, otherAnimations); CurrentView.Appeared = true; if (PreviousView != null) { PreviousView.Appeared = false; } }