summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/NativeValueConverterService.cs
blob: 69cccd9405881ef498360b1d39c109d42f4493ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System;
using Xamarin.Forms.Xaml.Internals;
using AView = Android.Views.View;

[assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.Android.NativeValueConverterService))]
namespace Xamarin.Forms.Platform.Android
{
	class NativeValueConverterService : INativeValueConverterService
	{
		public bool ConvertTo(object value, Type toType, out object nativeValue)
		{
			nativeValue = null;
			if (typeof(AView).IsInstanceOfType(value) && toType.IsAssignableFrom(typeof(View))) {
				nativeValue = ((AView)value).ToView();
				return true;
			}
			return false;
		}
	}
}