summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS/NativeValueConverterService.cs
blob: 9e20e0455fda49ab2af3f8696f1e506ef5c81262 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System;
using UIKit;

[assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.iOS.NativeValueConverterService))]

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