summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/NativeBindingService.cs
blob: 945726eb6eddcb4ccd0b4884ce57d35c90015f1e (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
32
33
34
35
36
37
38
using System;

using EObject = ElmSharp.EvasObject;

namespace Xamarin.Forms.Platform.Tizen
{
	class NativeBindingService : Xaml.INativeBindingService
	{
		public bool TrySetBinding(object target, string propertyName, BindingBase binding)
		{
			var view = target as EObject;
			if (view == null)
				return false;
			if (target.GetType().GetProperty(propertyName)?.GetMethod == null)
				return false;
			view.SetBinding(propertyName, binding);
			return true;
		}

		public bool TrySetBinding(object target, BindableProperty property, BindingBase binding)
		{
			var view = target as EObject;
			if (view == null)
				return false;
			view.SetBinding(property, binding);
			return true;
		}

		public bool TrySetValue(object target, BindableProperty property, object value)
		{
			var view = target as EObject;
			if (view == null)
				return false;
			view.SetValue(property, value);
			return true;
		}
	}
}