summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS/NativeValueConverterService.cs
blob: d2ead78685cbbf652ce969824b543fd708adef64 (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
´╗┐using System;
using Xamarin.Forms.Xaml.Internals;
using Xamarin.Forms.Internals;
#if __MOBILE__
using UIKit;

[assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.iOS.NativeValueConverterService))]
namespace Xamarin.Forms.Platform.iOS
#else
using UIView = AppKit.NSView;

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

namespace Xamarin.Forms.Platform.MacOS
#endif
{
	class NativeValueConverterService : 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;
		}
	}
}