summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorJohan Karlsson <johan.kson@gmail.com>2016-07-11 20:39:11 +0200
committerJason Smith <jason.smith@xamarin.com>2016-07-11 11:39:11 -0700
commit09ff9355326065902e610e4058f7e4ee3160cdaa (patch)
tree164307323b871bc41a4770517f02d9e4b43f8c76 /Xamarin.Forms.Core
parentf167024ef3a02c199c797b5313342dbe5d9a21de (diff)
downloadxamarin-forms-09ff9355326065902e610e4058f7e4ee3160cdaa.tar.gz
xamarin-forms-09ff9355326065902e610e4058f7e4ee3160cdaa.tar.bz2
xamarin-forms-09ff9355326065902e610e4058f7e4ee3160cdaa.zip
Added PoppedToRootEventArgs to track popped pages when calling PopToRoot (#229)
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/NavigationPage.cs6
-rw-r--r--Xamarin.Forms.Core/PoppedToRootEventArgs.cs18
-rw-r--r--Xamarin.Forms.Core/Xamarin.Forms.Core.csproj1
3 files changed, 23 insertions, 2 deletions
diff --git a/Xamarin.Forms.Core/NavigationPage.cs b/Xamarin.Forms.Core/NavigationPage.cs
index 85c8ac89..d7fb5f3e 100644
--- a/Xamarin.Forms.Core/NavigationPage.cs
+++ b/Xamarin.Forms.Core/NavigationPage.cs
@@ -319,7 +319,9 @@ namespace Xamarin.Forms
var root = (Page)PageController.InternalChildren.First();
- PageController.InternalChildren.ToArray().Where(c => c != root).ForEach(c => PageController.InternalChildren.Remove(c));
+ var childrenToRemove = PageController.InternalChildren.ToArray().Where(c => c != root);
+ foreach (var child in childrenToRemove)
+ PageController.InternalChildren.Remove(child);
CurrentPage = root;
@@ -335,7 +337,7 @@ namespace Xamarin.Forms
}
if (PoppedToRoot != null)
- PoppedToRoot(this, new NavigationEventArgs(root));
+ PoppedToRoot(this, new PoppedToRootEventArgs(root, childrenToRemove.OfType<Page>().ToList()));
}
async Task PushAsyncInner(Page page, bool animated)
diff --git a/Xamarin.Forms.Core/PoppedToRootEventArgs.cs b/Xamarin.Forms.Core/PoppedToRootEventArgs.cs
new file mode 100644
index 00000000..ead4f1a7
--- /dev/null
+++ b/Xamarin.Forms.Core/PoppedToRootEventArgs.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+
+namespace Xamarin.Forms
+{
+ public class PoppedToRootEventArgs : NavigationEventArgs
+ {
+ public PoppedToRootEventArgs(Page page, IEnumerable<Page> poppedPages) : base(page)
+ {
+ if (poppedPages == null)
+ throw new ArgumentNullException(nameof(poppedPages));
+
+ PoppedPages = poppedPages;
+ }
+
+ public IEnumerable<Page> PoppedPages { get; private set; }
+ }
+}
diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
index 3ba0c05b..d0cb293c 100644
--- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
+++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
@@ -415,6 +415,7 @@
<Compile Include="IApplicationController.cs" />
<Compile Include="IAppIndexingProvider.cs" />
<Compile Include="ListStringTypeConverter.cs" />
+ <Compile Include="PoppedToRootEventArgs.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<ItemGroup>