summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT/PageToRenderedElementConverter.cs
blob: 68e23d318d7ca23388bb4490931c4095c4a68db7 (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
27
28
29
30
31
using System;

#if WINDOWS_UWP

namespace Xamarin.Forms.Platform.UWP
#else

namespace Xamarin.Forms.Platform.WinRT
#endif
{
	public class PageToRenderedElementConverter : Windows.UI.Xaml.Data.IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, string language)
		{
			var page = value as Page;
			if (page == null)
				return null;

			IVisualElementRenderer renderer = page.GetOrCreateRenderer();
			if (renderer == null)
				return null;

			return renderer.ContainerElement;
		}

		public object ConvertBack(object value, Type targetType, object parameter, string language)
		{
			throw new NotImplementedException();
		}
	}
}