Skip to content

Commit

Permalink
Update Xamarin.Forms NavigationPageAdapter to allow users to override…
Browse files Browse the repository at this point in the history
… activate/deactivate logic when navigating
  • Loading branch information
bryanbcook committed Oct 20, 2017
1 parent e46151d commit 51d76f0
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Caliburn.Micro.Platform/xforms/NavigationPageAdapter.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System.Reflection;

namespace Caliburn.Micro.Xamarin.Forms {
namespace Caliburn.Micro.Xamarin.Forms {

using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using global::Xamarin.Forms;

Expand Down Expand Up @@ -74,13 +73,21 @@ protected virtual ContentPage CreateContentPage(ContentView view, object viewMod
return page;
}

private static void DeactivateView(BindableObject view)
/// <summary>
/// Apply logic to deactivate the active view when it is popped off the navigation stack
/// </summary>
/// <param name="view">the previously active view</param>
protected virtual void DeactivateView(BindableObject view)
{
var deactivate = view?.BindingContext as IDeactivate;
deactivate?.Deactivate(false);
}

private static void ActivateView(BindableObject view)
/// <summary>
/// Apply logic to activate a view when it is popped onto the navigation stack
/// </summary>
/// <param name="view">the view to activate</param>
protected virtual void ActivateView(BindableObject view)
{
var activate = view?.BindingContext as IActivate;
activate?.Activate();
Expand Down

0 comments on commit 51d76f0

Please sign in to comment.