2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Diagnostics;
5 using System.Reflection;
6 using System.Runtime.CompilerServices;
7 using Tizen.NUI.Binding.Internals;
9 namespace Tizen.NUI.Binding
12 /// Provides a mechanism by which application developers can propagate changes that are made to data in one object to another, by enabling validation, type coercion, and an event system.
14 [EditorBrowsable(EditorBrowsableState.Never)]
15 public abstract class BindableObject : INotifyPropertyChanged, IDynamicResourceHandler
18 /// Implements the bound property whose interface is provided by the BindingContext property.
20 internal static readonly BindableProperty BindingContextProperty =
21 BindableProperty.Create("BindingContext", typeof(object), typeof(BindableObject), default(object),
22 BindingMode.OneWay, null, BindingContextPropertyChanged, null, null, BindingContextPropertyBindingChanging);
24 readonly List<BindablePropertyContext> _properties = new List<BindablePropertyContext>(4);
27 object _inheritedContext;
30 /// Gets or sets object that contains the properties that will be targeted by the bound properties that belong to this BindableObject.
32 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
33 [EditorBrowsable(EditorBrowsableState.Never)]
34 public object BindingContext
36 get { return _inheritedContext ?? GetValue(BindingContextProperty); }
37 set { SetValue(BindingContextProperty, value); }
40 void IDynamicResourceHandler.SetDynamicResource(BindableProperty property, string key)
42 SetDynamicResource(property, key, false);
46 /// Raised when a property has changed.
48 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
49 [EditorBrowsable(EditorBrowsableState.Never)]
50 public event PropertyChangedEventHandler PropertyChanged;
53 /// Raised whenever the BindingContext property changes.
55 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
56 [EditorBrowsable(EditorBrowsableState.Never)]
57 public event EventHandler BindingContextChanged;
59 internal void ClearValue(BindableProperty property, bool fromStyle)
61 ClearValue(property, fromStyle: fromStyle, checkAccess: true);
65 /// Clears any value set by Xamarin.Forms.BindableObject.SetValue.
67 /// <param name="property">The BindableProperty to clear</param>
68 internal void ClearValue(BindableProperty property)
70 ClearValue(property, fromStyle: false, checkAccess: true);
74 /// Clears any value set by Xamarin.Forms.BindableObject.SetValue for the property that is identified by propertyKey.
76 /// <param name="propertyKey">The BindablePropertyKey that identifies the BindableProperty to clear.</param>
77 internal void ClearValue(BindablePropertyKey propertyKey)
79 if (propertyKey == null)
80 throw new ArgumentNullException("propertyKey");
82 ClearValue(propertyKey.BindableProperty, fromStyle:false, checkAccess: false);
86 /// Return true if the target property exists and has been set.
88 /// <param name="targetProperty">The target property</param>
89 /// <returns>return true if the target property exists and has been set</returns>
90 internal bool IsSet(BindableProperty targetProperty)
92 if (targetProperty == null)
93 throw new ArgumentNullException(nameof(targetProperty));
95 var bpcontext = GetContext(targetProperty);
96 return bpcontext != null
97 && (bpcontext.Attributes & BindableContextAttributes.IsDefaultValue) == 0;
101 /// Returns the value that is contained the BindableProperty.
103 /// <param name="property">The BindableProperty for which to get the value.</param>
104 /// <returns>The value that is contained the BindableProperty</returns>
105 internal object GetValue(BindableProperty property)
107 if (property == null)
108 throw new ArgumentNullException("property");
110 BindablePropertyContext context = property.DefaultValueCreator != null ? GetOrCreateContext(property) : GetContext(property);
113 return property.DefaultValue;
115 return context.Value;
119 /// Raised when a property is about to change.
121 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
122 [EditorBrowsable(EditorBrowsableState.Never)]
123 public event PropertyChangingEventHandler PropertyChanging;
126 /// Removes a previously set binding.
128 /// <param name="property">The BindableProperty from which to remove bindings.</param>
129 internal void RemoveBinding(BindableProperty property)
131 if (property == null)
132 throw new ArgumentNullException("property");
134 BindablePropertyContext context = GetContext(property);
135 if (context == null || context.Binding == null)
138 RemoveBinding(property, context);
142 /// Assigns a binding to a property.
144 /// <param name="targetProperty">The BindableProperty on which to set a binding.</param>
145 /// <param name="binding">The binding to set.</param>
146 internal void SetBinding(BindableProperty targetProperty, BindingBase binding)
148 SetBinding(targetProperty, binding, false);
151 private bool isCreateByXaml = false;
152 internal virtual bool IsCreateByXaml
156 return isCreateByXaml;
160 isCreateByXaml = value;
165 /// Sets the value of the specified property.
167 /// <param name="property">The BindableProperty on which to assign a value.</param>
168 /// <param name="value">The value to set.</param>
169 internal void SetValue(BindableProperty property, object value)
171 if (true == isCreateByXaml)
173 SetValue(property, value, false, true);
177 property.PropertyChanged?.Invoke(this, null, value);
181 internal void SetValueAndForceSendChangeSignal(BindableProperty property, object value)
183 if (property == null)
184 throw new ArgumentNullException("property");
186 if (true == isCreateByXaml)
188 if (property.IsReadOnly)
189 throw new InvalidOperationException(string.Format("The BindableProperty \"{0}\" is readonly.", property.PropertyName));
191 SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearDynamicResource,
192 SetValuePrivateFlags.ManuallySet | SetValuePrivateFlags.CheckAccess, true);
196 property.PropertyChanged?.Invoke(this, null, value);
201 /// Sets the value of the propertyKey.
203 /// <param name="propertyKey">The BindablePropertyKey on which to assign a value.</param>
204 /// <param name="value">The value to set.</param>
205 internal void SetValue(BindablePropertyKey propertyKey, object value)
207 if (propertyKey == null)
208 throw new ArgumentNullException("propertyKey");
210 SetValue(propertyKey.BindableProperty, value, false, false);
214 /// Set the inherited context to a neated element.
216 /// <param name="bindable">The object on which to set the inherited binding context.</param>
217 /// <param name="value">The inherited context to set.</param>
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public static void SetInheritedBindingContext(BindableObject bindable, object value)
221 BindablePropertyContext bpContext = bindable.GetContext(BindingContextProperty);
222 if (bpContext != null && ((bpContext.Attributes & BindableContextAttributes.IsManuallySet) != 0))
225 object oldContext = bindable._inheritedContext;
227 if (ReferenceEquals(oldContext, value))
230 if (bpContext != null && oldContext == null)
231 oldContext = bpContext.Value;
233 if (bpContext != null && bpContext.Binding != null)
235 bpContext.Binding.Context = value;
236 bindable._inheritedContext = null;
240 bindable._inheritedContext = value;
243 bindable.ApplyBindings(skipBindingContext:false, fromBindingContextChanged:true);
244 bindable.OnBindingContextChanged();
248 /// Apply the bindings to BindingContext.
250 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
251 [EditorBrowsable(EditorBrowsableState.Never)]
252 protected void ApplyBindings()
254 ApplyBindings(skipBindingContext: false, fromBindingContextChanged: false);
258 /// Override this method to execute an action when the BindingContext changes.
260 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
261 [EditorBrowsable(EditorBrowsableState.Never)]
262 protected virtual void OnBindingContextChanged()
264 BindingContextChanged?.Invoke(this, EventArgs.Empty);
268 /// Call this method from a child class to notify that a change happened on a property.
270 /// <param name="propertyName">The name of the property that changed.</param>
271 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
272 [EditorBrowsable(EditorBrowsableState.Never)]
273 protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
274 => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
277 /// Call this method from a child class to notify that a change is going to happen on a property.
279 /// <param name="propertyName">The name of the property that is changing.</param>
280 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
281 [EditorBrowsable(EditorBrowsableState.Never)]
282 protected virtual void OnPropertyChanging([CallerMemberName] string propertyName = null)
283 => PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
286 /// Unapplies all previously set bindings.
288 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
289 [EditorBrowsable(EditorBrowsableState.Never)]
290 protected void UnapplyBindings()
292 for (int i = 0, _propertiesCount = _properties.Count; i < _propertiesCount; i++) {
293 BindablePropertyContext context = _properties [i];
294 if (context.Binding == null)
297 context.Binding.Unapply();
301 internal bool GetIsBound(BindableProperty targetProperty)
303 if (targetProperty == null)
304 throw new ArgumentNullException("targetProperty");
306 BindablePropertyContext bpcontext = GetContext(targetProperty);
307 return bpcontext != null && bpcontext.Binding != null;
311 /// Returns the value that is contained the BindableProperty.
313 /// <param name="property0">The BindableProperty instance.</param>
314 /// <param name="property1">The BindableProperty instance.</param>
315 /// <returns>The value that is contained the BindableProperty</returns>
316 internal object[] GetValues(BindableProperty property0, BindableProperty property1)
318 var values = new object[2];
320 for (var i = 0; i < _properties.Count; i++)
322 BindablePropertyContext context = _properties[i];
324 if (ReferenceEquals(context.Property, property0))
326 values[0] = context.Value;
329 else if (ReferenceEquals(context.Property, property1))
331 values[1] = context.Value;
335 if (property0 == null && property1 == null)
339 if (!ReferenceEquals(property0, null))
340 values[0] = property0.DefaultValueCreator == null ? property0.DefaultValue : CreateAndAddContext(property0).Value;
341 if (!ReferenceEquals(property1, null))
342 values[1] = property1.DefaultValueCreator == null ? property1.DefaultValue : CreateAndAddContext(property1).Value;
348 /// Returns the value that is contained the BindableProperty.
350 /// <param name="property0">The BindableProperty instance.</param>
351 /// <param name="property1">The BindableProperty instance.</param>
352 /// <param name="property2">The BindableProperty instance.</param>
353 /// <returns>The value that is contained the BindableProperty</returns>
354 internal object[] GetValues(BindableProperty property0, BindableProperty property1, BindableProperty property2)
356 var values = new object[3];
358 for (var i = 0; i < _properties.Count; i++)
360 BindablePropertyContext context = _properties[i];
362 if (ReferenceEquals(context.Property, property0))
364 values[0] = context.Value;
367 else if (ReferenceEquals(context.Property, property1))
369 values[1] = context.Value;
372 else if (ReferenceEquals(context.Property, property2))
374 values[2] = context.Value;
378 if (property0 == null && property1 == null && property2 == null)
382 if (!ReferenceEquals(property0, null))
383 values[0] = property0.DefaultValueCreator == null ? property0.DefaultValue : CreateAndAddContext(property0).Value;
384 if (!ReferenceEquals(property1, null))
385 values[1] = property1.DefaultValueCreator == null ? property1.DefaultValue : CreateAndAddContext(property1).Value;
386 if (!ReferenceEquals(property2, null))
387 values[2] = property2.DefaultValueCreator == null ? property2.DefaultValue : CreateAndAddContext(property2).Value;
393 /// Returns the value that is contained the BindableProperty.
395 /// <param name="properties">The array of the BindableProperty instances</param>
396 /// <returns>The values that is contained the BindableProperty instances.</returns>
397 internal object[] GetValues(params BindableProperty[] properties)
399 var values = new object[properties.Length];
400 for (var i = 0; i < _properties.Count; i++) {
401 var context = _properties[i];
402 var index = properties.IndexOf(context.Property);
405 values[index] = context.Value;
407 for (var i = 0; i < values.Length; i++) {
408 if (!ReferenceEquals(values[i], null))
410 values[i] = properties[i].DefaultValueCreator == null ? properties[i].DefaultValue : CreateAndAddContext(properties[i]).Value;
415 internal virtual void OnRemoveDynamicResource(BindableProperty property)
419 internal virtual void OnSetDynamicResource(BindableProperty property, string key)
423 internal void RemoveDynamicResource(BindableProperty property)
425 if (property == null)
426 throw new ArgumentNullException("property");
428 OnRemoveDynamicResource(property);
429 BindablePropertyContext context = GetOrCreateContext(property);
430 context.Attributes &= ~BindableContextAttributes.IsDynamicResource;
433 internal void SetBinding(BindableProperty targetProperty, BindingBase binding, bool fromStyle)
435 if (targetProperty == null)
436 throw new ArgumentNullException("targetProperty");
438 throw new ArgumentNullException("binding");
440 if (fromStyle && !CanBeSetFromStyle(targetProperty))
443 var context = GetOrCreateContext(targetProperty);
445 context.Attributes |= BindableContextAttributes.IsSetFromStyle;
447 context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
449 if (context.Binding != null)
450 context.Binding.Unapply();
452 BindingBase oldBinding = context.Binding;
453 context.Binding = binding;
455 targetProperty.BindingChanging?.Invoke(this, oldBinding, binding);
457 binding.Apply(BindingContext, this, targetProperty);
460 bool CanBeSetFromStyle(BindableProperty property)
462 var context = GetContext(property);
465 if ((context.Attributes & BindableContextAttributes.IsSetFromStyle) == BindableContextAttributes.IsSetFromStyle)
467 if ((context.Attributes & BindableContextAttributes.IsDefaultValue) == BindableContextAttributes.IsDefaultValue)
469 if ((context.Attributes & BindableContextAttributes.IsDefaultValueCreated) == BindableContextAttributes.IsDefaultValueCreated)
474 internal void SetDynamicResource(BindableProperty property, string key)
476 SetDynamicResource(property, key, false);
479 internal void SetDynamicResource(BindableProperty property, string key, bool fromStyle)
481 if (property == null)
482 throw new ArgumentNullException(nameof(property));
483 if (string.IsNullOrEmpty(key))
484 throw new ArgumentNullException(nameof(key));
485 if (fromStyle && !CanBeSetFromStyle(property))
488 var context = GetOrCreateContext(property);
490 context.Attributes |= BindableContextAttributes.IsDynamicResource;
492 context.Attributes |= BindableContextAttributes.IsSetFromStyle;
494 context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
496 OnSetDynamicResource(property, key);
499 internal void SetValue(BindableProperty property, object value, bool fromStyle)
501 SetValue(property, value, fromStyle, true);
504 internal void SetValueCore(BindablePropertyKey propertyKey, object value, SetValueFlags attributes = SetValueFlags.None)
506 SetValueCore(propertyKey.BindableProperty, value, attributes, SetValuePrivateFlags.None, false);
510 /// For internal use.
512 /// <param name="property">The BindableProperty on which to assign a value.</param>
513 /// <param name="value">The value to set</param>
514 /// <param name="attributes">The set value flag</param>
515 [EditorBrowsable(EditorBrowsableState.Never)]
516 internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes = SetValueFlags.None)
518 SetValueCore(property, value, attributes, SetValuePrivateFlags.Default, false);
521 internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, bool forceSendChangeSignal)
523 bool checkAccess = (privateAttributes & SetValuePrivateFlags.CheckAccess) != 0;
524 bool manuallySet = (privateAttributes & SetValuePrivateFlags.ManuallySet) != 0;
525 bool silent = (privateAttributes & SetValuePrivateFlags.Silent) != 0;
526 bool fromStyle = (privateAttributes & SetValuePrivateFlags.FromStyle) != 0;
527 bool converted = (privateAttributes & SetValuePrivateFlags.Converted) != 0;
529 if (property == null)
530 throw new ArgumentNullException("property");
531 if (checkAccess && property.IsReadOnly)
533 Debug.WriteLine("Can not set the BindableProperty \"{0}\" because it is readonly.", property.PropertyName);
537 if (!converted && !property.TryConvert(ref value))
539 Console.WriteLine("SetValue", "Can not convert {0} to type '{1}'", value, property.ReturnType);
543 if (property.ValidateValue != null && !property.ValidateValue(this, value))
544 throw new ArgumentException("Value was an invalid value for " + property.PropertyName, "value");
546 if (property.CoerceValue != null)
547 value = property.CoerceValue(this, value);
549 BindablePropertyContext context = GetOrCreateContext(property);
551 context.Attributes |= BindableContextAttributes.IsManuallySet;
552 context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
554 context.Attributes &= ~BindableContextAttributes.IsManuallySet;
557 context.Attributes |= BindableContextAttributes.IsSetFromStyle;
558 // else omitted on purpose
560 bool currentlyApplying = _applying;
562 if ((context.Attributes & BindableContextAttributes.IsBeingSet) != 0)
564 Queue<SetValueArgs> delayQueue = context.DelayedSetters;
565 if (delayQueue == null)
566 context.DelayedSetters = delayQueue = new Queue<SetValueArgs>();
568 delayQueue.Enqueue(new SetValueArgs(property, context, value, currentlyApplying, attributes));
572 context.Attributes |= BindableContextAttributes.IsBeingSet;
573 SetValueActual(property, context, value, currentlyApplying, forceSendChangeSignal, attributes, silent);
575 Queue<SetValueArgs> delayQueue = context.DelayedSetters;
576 if (delayQueue != null)
578 while (delayQueue.Count > 0)
580 SetValueArgs s = delayQueue.Dequeue();
581 SetValueActual(s.Property, s.Context, s.Value, s.CurrentlyApplying, forceSendChangeSignal, s.Attributes);
584 context.DelayedSetters = null;
587 context.Attributes &= ~BindableContextAttributes.IsBeingSet;
591 internal void ApplyBindings(bool skipBindingContext, bool fromBindingContextChanged)
593 var prop = _properties.ToArray();
594 for (int i = 0, propLength = prop.Length; i < propLength; i++) {
595 BindablePropertyContext context = prop [i];
596 BindingBase binding = context.Binding;
600 if (skipBindingContext && ReferenceEquals(context.Property, BindingContextProperty))
603 binding.Unapply(fromBindingContextChanged: fromBindingContextChanged);
604 binding.Apply(BindingContext, this, context.Property, fromBindingContextChanged: fromBindingContextChanged);
608 static void BindingContextPropertyBindingChanging(BindableObject bindable, BindingBase oldBindingBase, BindingBase newBindingBase)
610 object context = bindable._inheritedContext;
611 var oldBinding = oldBindingBase as Binding;
612 var newBinding = newBindingBase as Binding;
614 if (context == null && oldBinding != null)
615 context = oldBinding.Context;
616 if (context != null && newBinding != null)
617 newBinding.Context = context;
620 static void BindingContextPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
622 bindable._inheritedContext = null;
623 bindable.ApplyBindings(skipBindingContext: true, fromBindingContextChanged:true);
624 bindable.OnBindingContextChanged();
627 void ClearValue(BindableProperty property, bool fromStyle, bool checkAccess)
629 if (property == null)
630 throw new ArgumentNullException(nameof(property));
632 if (checkAccess && property.IsReadOnly)
633 throw new InvalidOperationException(string.Format("The BindableProperty \"{0}\" is readonly.", property.PropertyName));
635 BindablePropertyContext bpcontext = GetContext(property);
636 if (bpcontext == null)
639 if (fromStyle && !CanBeSetFromStyle(property))
642 object original = bpcontext.Value;
644 object newValue = property.GetDefaultValue(this);
646 bool same = Equals(original, newValue);
649 property.PropertyChanging?.Invoke(this, original, newValue);
651 OnPropertyChanging(property.PropertyName);
654 bpcontext.Attributes &= ~BindableContextAttributes.IsManuallySet;
655 bpcontext.Value = newValue;
656 if (property.DefaultValueCreator == null)
657 bpcontext.Attributes |= BindableContextAttributes.IsDefaultValue;
659 bpcontext.Attributes |= BindableContextAttributes.IsDefaultValueCreated;
663 OnPropertyChanged(property.PropertyName);
664 property.PropertyChanged?.Invoke(this, original, newValue);
668 [MethodImpl(MethodImplOptions.AggressiveInlining)]
669 BindablePropertyContext CreateAndAddContext(BindableProperty property)
671 var context = new BindablePropertyContext { Property = property, Value = property.DefaultValueCreator != null ? property.DefaultValueCreator(this) : property.DefaultValue };
673 if (property.DefaultValueCreator == null)
674 context.Attributes = BindableContextAttributes.IsDefaultValue;
676 context.Attributes = BindableContextAttributes.IsDefaultValueCreated;
678 _properties.Add(context);
682 [MethodImpl(MethodImplOptions.AggressiveInlining)]
683 BindablePropertyContext GetContext(BindableProperty property)
685 List<BindablePropertyContext> properties = _properties;
687 for (var i = 0; i < properties.Count; i++)
689 BindablePropertyContext context = properties[i];
690 if (ReferenceEquals(context.Property, property))
697 [MethodImpl(MethodImplOptions.AggressiveInlining)]
698 BindablePropertyContext GetOrCreateContext(BindableProperty property)
700 BindablePropertyContext context = GetContext(property);
703 context = CreateAndAddContext(property);
705 else if (property.DefaultValueCreator != null )
707 context.Value = property.DefaultValueCreator(this); //Update Value from dali
713 void RemoveBinding(BindableProperty property, BindablePropertyContext context)
715 context.Binding.Unapply();
717 property.BindingChanging?.Invoke(this, context.Binding, null);
719 context.Binding = null;
722 void SetValue(BindableProperty property, object value, bool fromStyle, bool checkAccess)
724 if (property == null)
725 throw new ArgumentNullException("property");
727 if (checkAccess && property.IsReadOnly)
728 throw new InvalidOperationException(string.Format("The BindableProperty \"{0}\" is readonly.", property.PropertyName));
730 if (fromStyle && !CanBeSetFromStyle(property))
733 SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearDynamicResource,
734 (fromStyle ? SetValuePrivateFlags.FromStyle : SetValuePrivateFlags.ManuallySet) | (checkAccess ? SetValuePrivateFlags.CheckAccess : 0),
738 void SetValueActual(BindableProperty property, BindablePropertyContext context, object value, bool currentlyApplying, bool forceSendChangeSignal, SetValueFlags attributes, bool silent = false)
740 object original = context.Value;
741 bool raiseOnEqual = (attributes & SetValueFlags.RaiseOnEqual) != 0;
742 bool clearDynamicResources = (attributes & SetValueFlags.ClearDynamicResource) != 0;
743 bool clearOneWayBindings = (attributes & SetValueFlags.ClearOneWayBindings) != 0;
744 bool clearTwoWayBindings = (attributes & SetValueFlags.ClearTwoWayBindings) != 0;
746 bool same = ReferenceEquals(context.Property, BindingContextProperty) ? ReferenceEquals(value, original) : Equals(value, original);
747 if (!silent && (!same || raiseOnEqual))
749 property.PropertyChanging?.Invoke(this, original, value);
751 OnPropertyChanging(property.PropertyName);
754 if (!same || raiseOnEqual)
756 context.Value = value;
759 context.Attributes &= ~BindableContextAttributes.IsDefaultValue;
760 context.Attributes &= ~BindableContextAttributes.IsDefaultValueCreated;
762 if ((context.Attributes & BindableContextAttributes.IsDynamicResource) != 0 && clearDynamicResources)
763 RemoveDynamicResource(property);
765 BindingBase binding = context.Binding;
768 if (clearOneWayBindings && binding.GetRealizedMode(property) == BindingMode.OneWay || clearTwoWayBindings && binding.GetRealizedMode(property) == BindingMode.TwoWay)
770 RemoveBinding(property, context);
777 if ((!same || raiseOnEqual))
779 property.PropertyChanged?.Invoke(this, original, value);
781 if (binding != null && !currentlyApplying)
788 OnPropertyChanged(property.PropertyName);
790 else if (true == same && true == forceSendChangeSignal)
792 if (binding != null && !currentlyApplying)
799 OnPropertyChanged(property.PropertyName);
805 enum BindableContextAttributes
807 IsManuallySet = 1 << 0,
809 IsDynamicResource = 1 << 2,
810 IsSetFromStyle = 1 << 3,
811 IsDefaultValue = 1 << 4,
812 IsDefaultValueCreated = 1 << 5,
815 class BindablePropertyContext
817 public BindableContextAttributes Attributes;
818 public BindingBase Binding;
819 public Queue<SetValueArgs> DelayedSetters;
820 public BindableProperty Property;
825 internal enum SetValuePrivateFlags
828 CheckAccess = 1 << 0,
830 ManuallySet = 1 << 2,
833 Default = CheckAccess
838 public readonly SetValueFlags Attributes;
839 public readonly BindablePropertyContext Context;
840 public readonly bool CurrentlyApplying;
841 public readonly BindableProperty Property;
842 public readonly object Value;
844 public SetValueArgs(BindableProperty property, BindablePropertyContext context, object value, bool currentlyApplying, SetValueFlags attributes)
849 CurrentlyApplying = currentlyApplying;
850 Attributes = attributes;
856 namespace Tizen.NUI.Binding.Internals
859 /// SetValueFlags. For internal use.
862 [EditorBrowsable(EditorBrowsableState.Never)]
863 public enum SetValueFlags
868 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
869 [EditorBrowsable(EditorBrowsableState.Never)]
873 /// Clear OneWay bindings.
875 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
876 [EditorBrowsable(EditorBrowsableState.Never)]
877 ClearOneWayBindings = 1 << 0,
880 /// Clear TwoWay bindings.
882 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
883 [EditorBrowsable(EditorBrowsableState.Never)]
884 ClearTwoWayBindings = 1 << 1,
887 /// Clear dynamic resource.
889 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
890 [EditorBrowsable(EditorBrowsableState.Never)]
891 ClearDynamicResource = 1 << 2,
896 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
897 [EditorBrowsable(EditorBrowsableState.Never)]
898 RaiseOnEqual = 1 << 3