2 using System.ComponentModel;
3 using System.Reflection;
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 abstract class Behavior : BindableObject, IAttachedObject
11 internal Behavior(Type associatedType)
13 if (associatedType == null)
14 throw new ArgumentNullException(nameof(associatedType));
15 AssociatedType = associatedType;
18 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
19 [EditorBrowsable(EditorBrowsableState.Never)]
20 protected Type AssociatedType { get; }
22 void IAttachedObject.AttachTo(BindableObject bindable)
25 throw new ArgumentNullException(nameof(bindable));
26 if (!AssociatedType.IsInstanceOfType(bindable))
27 throw new InvalidOperationException("bindable not an instance of AssociatedType");
28 OnAttachedTo(bindable);
31 void IAttachedObject.DetachFrom(BindableObject bindable)
33 OnDetachingFrom(bindable);
36 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
37 [EditorBrowsable(EditorBrowsableState.Never)]
38 protected virtual void OnAttachedTo(BindableObject bindable)
42 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
43 [EditorBrowsable(EditorBrowsableState.Never)]
44 protected virtual void OnDetachingFrom(BindableObject bindable)
49 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
50 [EditorBrowsable(EditorBrowsableState.Never)]
51 public abstract class Behavior<T> : Behavior where T : BindableObject
53 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
54 [EditorBrowsable(EditorBrowsableState.Never)]
55 protected Behavior() : base(typeof(T))
59 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
60 [EditorBrowsable(EditorBrowsableState.Never)]
61 protected override void OnAttachedTo(BindableObject bindable)
63 base.OnAttachedTo(bindable);
64 OnAttachedTo((T)bindable);
67 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 protected virtual void OnAttachedTo(T bindable)
73 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
74 [EditorBrowsable(EditorBrowsableState.Never)]
75 protected override void OnDetachingFrom(BindableObject bindable)
77 OnDetachingFrom((T)bindable);
78 base.OnDetachingFrom(bindable);
81 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
82 [EditorBrowsable(EditorBrowsableState.Never)]
83 protected virtual void OnDetachingFrom(T bindable)