2 using System.Linq.Expressions;
4 namespace Tizen.NUI.Binding
6 internal static class BindableObjectExtensions
8 public static void SetBinding(this BindableObject self, BindableProperty targetProperty, string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null,
9 string stringFormat = null)
12 throw new ArgumentNullException("self");
13 if (targetProperty == null)
14 throw new ArgumentNullException("targetProperty");
16 var binding = new Binding(path, mode, converter, stringFormat: stringFormat);
17 self.SetBinding(targetProperty, binding);
21 public static void SetBinding<TSource>(this BindableObject self, BindableProperty targetProperty, Expression<Func<TSource, object>> sourceProperty, BindingMode mode = BindingMode.Default,
22 IValueConverter converter = null, string stringFormat = null)
25 throw new ArgumentNullException("self");
26 if (targetProperty == null)
27 throw new ArgumentNullException("targetProperty");
28 if (sourceProperty == null)
29 throw new ArgumentNullException("sourceProperty");
31 Binding binding = Binding.Create(sourceProperty, mode, converter, stringFormat: stringFormat);
32 self.SetBinding(targetProperty, binding);