2 using System.ComponentModel;
3 using System.Linq.Expressions;
5 namespace Tizen.NUI.Binding
7 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
8 [EditorBrowsable(EditorBrowsableState.Never)]
9 public static class BindableObjectExtensions
11 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
12 [EditorBrowsable(EditorBrowsableState.Never)]
13 public static void SetBinding(this BindableObject self, BindableProperty targetProperty, string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null,
14 string stringFormat = null)
17 throw new ArgumentNullException(nameof(self));
18 if (targetProperty == null)
19 throw new ArgumentNullException(nameof(targetProperty));
21 var binding = new Binding(path, mode, converter, stringFormat: stringFormat);
22 self.SetBinding(targetProperty, binding);
25 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
26 [EditorBrowsable(EditorBrowsableState.Never)]
27 [ObsoleteAttribute(" ", false)]
28 public static void SetBinding<TSource>(this BindableObject self, BindableProperty targetProperty, Expression<Func<TSource, object>> sourceProperty, BindingMode mode = BindingMode.Default,
29 IValueConverter converter = null, string stringFormat = null)
32 throw new ArgumentNullException(nameof(self));
33 if (targetProperty == null)
34 throw new ArgumentNullException(nameof(targetProperty));
35 if (sourceProperty == null)
36 throw new ArgumentNullException(nameof(sourceProperty));
38 Binding binding = Binding.Create(sourceProperty, mode, converter, stringFormat: stringFormat);
39 self.SetBinding(targetProperty, binding);