summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT/ViewExtensions.cs
blob: 9e382ab9f9d7f806f7d1c8e48867a3f3712e592c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System.Collections.Generic;

#if WINDOWS_UWP

namespace Xamarin.Forms.Platform.UWP
#else

namespace Xamarin.Forms.Platform.WinRT
#endif
{
	internal static class ViewExtensions
	{
		public static IEnumerable<Page> GetParentPages(this Page target)
		{
			var result = new List<Page>();
			var parent = target.Parent as Page;
			while (!Application.IsApplicationOrNull(parent))
			{
				result.Add(parent);
				parent = parent.Parent as Page;
			}

			return result;
		}
	}
}