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 internal bool isCreateByXaml = false;
154 /// Sets the value of the specified property.
156 /// <param name="property">The BindableProperty on which to assign a value.</param>
157 /// <param name="value">The value to set.</param>
158 internal void SetValue(BindableProperty property, object value)
160 if (true == isCreateByXaml)
162 SetValue(property, value, false, true);
166 property.PropertyChanged?.Invoke(this, null, value);
170 internal void SetValueAndForceSendChangeSignal(BindableProperty property, object value)
172 if (property == null)
173 throw new ArgumentNullException("property");
175 if (true == isCreateByXaml)
177 if (property.IsReadOnly)
178 throw new InvalidOperationException(string.Format("The BindableProperty \"{0}\" is readonly.", property.PropertyName));
180 SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearDynamicResource,
181 SetValuePrivateFlags.ManuallySet | SetValuePrivateFlags.CheckAccess, true);
185 property.PropertyChanged?.Invoke(this, null, value);
190 /// Sets the value of the propertyKey.
192 /// <param name="propertyKey">The BindablePropertyKey on which to assign a value.</param>
193 /// <param name="value">The value to set.</param>
194 internal void SetValue(BindablePropertyKey propertyKey, object value)
196 if (propertyKey == null)
197 throw new ArgumentNullException("propertyKey");
199 SetValue(propertyKey.BindableProperty, value, false, false);
203 /// Set the inherited context to a neated element.
205 /// <param name="bindable">The object on which to set the inherited binding context.</param>
206 /// <param name="value">The inherited context to set.</param>
207 [EditorBrowsable(EditorBrowsableState.Never)]
208 public static void SetInheritedBindingContext(BindableObject bindable, object value)
210 BindablePropertyContext bpContext = bindable.GetContext(BindingContextProperty);
211 if (bpContext != null && ((bpContext.Attributes & BindableContextAttributes.IsManuallySet) != 0))
214 object oldContext = bindable._inheritedContext;
216 if (ReferenceEquals(oldContext, value))
219 if (bpContext != null && oldContext == null)
220 oldContext = bpContext.Value;
222 if (bpContext != null && bpContext.Binding != null)
224 bpContext.Binding.Context = value;
225 bindable._inheritedContext = null;
229 bindable._inheritedContext = value;
232 bindable.ApplyBindings(skipBindingContext:false, fromBindingContextChanged:true);
233 bindable.OnBindingContextChanged();
237 /// Apply the bindings to BindingContext.
239 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
240 [EditorBrowsable(EditorBrowsableState.Never)]
241 protected void ApplyBindings()
243 ApplyBindings(skipBindingContext: false, fromBindingContextChanged: false);
247 /// Override this method to execute an action when the BindingContext changes.
249 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
250 [EditorBrowsable(EditorBrowsableState.Never)]
251 protected virtual void OnBindingContextChanged()
253 BindingContextChanged?.Invoke(this, EventArgs.Empty);
257 /// Call this method from a child class to notify that a change happened on a property.
259 /// <param name="propertyName">The name of the property that changed.</param>
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 OnPropertyChanged([CallerMemberName] string propertyName = null)
263 => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
266 /// Call this method from a child class to notify that a change is going to happen on a property.
268 /// <param name="propertyName">The name of the property that is changing.</param>
269 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
270 [EditorBrowsable(EditorBrowsableState.Never)]
271 protected virtual void OnPropertyChanging([CallerMemberName] string propertyName = null)
272 => PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
275 /// Unapplies all previously set bindings.
277 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
278 [EditorBrowsable(EditorBrowsableState.Never)]
279 protected void UnapplyBindings()
281 for (int i = 0, _propertiesCount = _properties.Count; i < _propertiesCount; i++) {
282 BindablePropertyContext context = _properties [i];
283 if (context.Binding == null)
286 context.Binding.Unapply();
290 internal bool GetIsBound(BindableProperty targetProperty)
292 if (targetProperty == null)
293 throw new ArgumentNullException("targetProperty");
295 BindablePropertyContext bpcontext = GetContext(targetProperty);
296 return bpcontext != null && bpcontext.Binding != null;
300 /// Returns the value that is contained the BindableProperty.
302 /// <param name="property0">The BindableProperty instance.</param>
303 /// <param name="property1">The BindableProperty instance.</param>
304 /// <returns>The value that is contained the BindableProperty</returns>
305 internal object[] GetValues(BindableProperty property0, BindableProperty property1)
307 var values = new object[2];
309 for (var i = 0; i < _properties.Count; i++)
311 BindablePropertyContext context = _properties[i];
313 if (ReferenceEquals(context.Property, property0))
315 values[0] = context.Value;
318 else if (ReferenceEquals(context.Property, property1))
320 values[1] = context.Value;
324 if (property0 == null && property1 == null)
328 if (!ReferenceEquals(property0, null))
329 values[0] = property0.DefaultValueCreator == null ? property0.DefaultValue : CreateAndAddContext(property0).Value;
330 if (!ReferenceEquals(property1, null))
331 values[1] = property1.DefaultValueCreator == null ? property1.DefaultValue : CreateAndAddContext(property1).Value;
337 /// Returns the value that is contained the BindableProperty.
339 /// <param name="property0">The BindableProperty instance.</param>
340 /// <param name="property1">The BindableProperty instance.</param>
341 /// <param name="property2">The BindableProperty instance.</param>
342 /// <returns>The value that is contained the BindableProperty</returns>
343 internal object[] GetValues(BindableProperty property0, BindableProperty property1, BindableProperty property2)
345 var values = new object[3];
347 for (var i = 0; i < _properties.Count; i++)
349 BindablePropertyContext context = _properties[i];
351 if (ReferenceEquals(context.Property, property0))
353 values[0] = context.Value;
356 else if (ReferenceEquals(context.Property, property1))
358 values[1] = context.Value;
361 else if (ReferenceEquals(context.Property, property2))
363 values[2] = context.Value;
367 if (property0 == null && property1 == null && property2 == null)
371 if (!ReferenceEquals(property0, null))
372 values[0] = property0.DefaultValueCreator == null ? property0.DefaultValue : CreateAndAddContext(property0).Value;
373 if (!ReferenceEquals(property1, null))
374 values[1] = property1.DefaultValueCreator == null ? property1.DefaultValue : CreateAndAddContext(property1).Value;
375 if (!ReferenceEquals(property2, null))
376 values[2] = property2.DefaultValueCreator == null ? property2.DefaultValue : CreateAndAddContext(property2).Value;
382 /// Returns the value that is contained the BindableProperty.
384 /// <param name="properties">The array of the BindableProperty instances</param>
385 /// <returns>The values that is contained the BindableProperty instances.</returns>
386 internal object[] GetValues(params BindableProperty[] properties)
388 var values = new object[properties.Length];
389 for (var i = 0; i < _properties.Count; i++) {
390 var context = _properties[i];
391 var index = properties.IndexOf(context.Property);
394 values[index] = context.Value;
396 for (var i = 0; i < values.Length; i++) {
397 if (!ReferenceEquals(values[i], null))
399 values[i] = properties[i].DefaultValueCreator == null ? properties[i].DefaultValue : CreateAndAddContext(properties[i]).Value;
404 internal virtual void OnRemoveDynamicResource(BindableProperty property)
408 internal virtual void OnSetDynamicResource(BindableProperty property, string key)
412 internal void RemoveDynamicResource(BindableProperty property)
414 if (property == null)
415 throw new ArgumentNullException("property");
417 OnRemoveDynamicResource(property);
418 BindablePropertyContext context = GetOrCreateContext(property);
419 context.Attributes &= ~BindableContextAttributes.IsDynamicResource;
422 internal void SetBinding(BindableProperty targetProperty, BindingBase binding, bool fromStyle)
424 if (targetProperty == null)
425 throw new ArgumentNullException("targetProperty");
427 throw new ArgumentNullException("binding");
429 if (fromStyle && !CanBeSetFromStyle(targetProperty))
432 var context = GetOrCreateContext(targetProperty);
434 context.Attributes |= BindableContextAttributes.IsSetFromStyle;
436 context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
438 if (context.Binding != null)
439 context.Binding.Unapply();
441 BindingBase oldBinding = context.Binding;
442 context.Binding = binding;
444 targetProperty.BindingChanging?.Invoke(this, oldBinding, binding);
446 binding.Apply(BindingContext, this, targetProperty);
449 bool CanBeSetFromStyle(BindableProperty property)
451 var context = GetContext(property);
454 if ((context.Attributes & BindableContextAttributes.IsSetFromStyle) == BindableContextAttributes.IsSetFromStyle)
456 if ((context.Attributes & BindableContextAttributes.IsDefaultValue) == BindableContextAttributes.IsDefaultValue)
458 if ((context.Attributes & BindableContextAttributes.IsDefaultValueCreated) == BindableContextAttributes.IsDefaultValueCreated)
463 internal void SetDynamicResource(BindableProperty property, string key)
465 SetDynamicResource(property, key, false);
468 internal void SetDynamicResource(BindableProperty property, string key, bool fromStyle)
470 if (property == null)
471 throw new ArgumentNullException(nameof(property));
472 if (string.IsNullOrEmpty(key))
473 throw new ArgumentNullException(nameof(key));
474 if (fromStyle && !CanBeSetFromStyle(property))
477 var context = GetOrCreateContext(property);
479 context.Attributes |= BindableContextAttributes.IsDynamicResource;
481 context.Attributes |= BindableContextAttributes.IsSetFromStyle;
483 context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
485 OnSetDynamicResource(property, key);
488 internal void SetValue(BindableProperty property, object value, bool fromStyle)
490 SetValue(property, value, fromStyle, true);
493 internal void SetValueCore(BindablePropertyKey propertyKey, object value, SetValueFlags attributes = SetValueFlags.None)
495 SetValueCore(propertyKey.BindableProperty, value, attributes, SetValuePrivateFlags.None, false);
499 /// For internal use.
501 /// <param name="property">The BindableProperty on which to assign a value.</param>
502 /// <param name="value">The value to set</param>
503 /// <param name="attributes">The set value flag</param>
504 [EditorBrowsable(EditorBrowsableState.Never)]
505 internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes = SetValueFlags.None)
507 SetValueCore(property, value, attributes, SetValuePrivateFlags.Default, false);
510 internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, bool forceSendChangeSignal)
512 bool checkAccess = (privateAttributes & SetValuePrivateFlags.CheckAccess) != 0;
513 bool manuallySet = (privateAttributes & SetValuePrivateFlags.ManuallySet) != 0;
514 bool silent = (privateAttributes & SetValuePrivateFlags.Silent) != 0;
515 bool fromStyle = (privateAttributes & SetValuePrivateFlags.FromStyle) != 0;
516 bool converted = (privateAttributes & SetValuePrivateFlags.Converted) != 0;
518 if (property == null)
519 throw new ArgumentNullException("property");
520 if (checkAccess && property.IsReadOnly)
522 Debug.WriteLine("Can not set the BindableProperty \"{0}\" because it is readonly.", property.PropertyName);
526 if (!converted && !property.TryConvert(ref value))
528 Console.WriteLine("SetValue", "Can not convert {0} to type '{1}'", value, property.ReturnType);
532 if (property.ValidateValue != null && !property.ValidateValue(this, value))
533 throw new ArgumentException("Value was an invalid value for " + property.PropertyName, "value");
535 if (property.CoerceValue != null)
536 value = property.CoerceValue(this, value);
538 BindablePropertyContext context = GetOrCreateContext(property);
540 context.Attributes |= BindableContextAttributes.IsManuallySet;
541 context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
543 context.Attributes &= ~BindableContextAttributes.IsManuallySet;
546 context.Attributes |= BindableContextAttributes.IsSetFromStyle;
547 // else omitted on purpose
549 bool currentlyApplying = _applying;
551 if ((context.Attributes & BindableContextAttributes.IsBeingSet) != 0)
553 Queue<SetValueArgs> delayQueue = context.DelayedSetters;
554 if (delayQueue == null)
555 context.DelayedSetters = delayQueue = new Queue<SetValueArgs>();
557 delayQueue.Enqueue(new SetValueArgs(property, context, value, currentlyApplying, attributes));
561 context.Attributes |= BindableContextAttributes.IsBeingSet;
562 SetValueActual(property, context, value, currentlyApplying, forceSendChangeSignal, attributes, silent);
564 Queue<SetValueArgs> delayQueue = context.DelayedSetters;
565 if (delayQueue != null)
567 while (delayQueue.Count > 0)
569 SetValueArgs s = delayQueue.Dequeue();
570 SetValueActual(s.Property, s.Context, s.Value, s.CurrentlyApplying, forceSendChangeSignal, s.Attributes);
573 context.DelayedSetters = null;
576 context.Attributes &= ~BindableContextAttributes.IsBeingSet;
580 internal void ApplyBindings(bool skipBindingContext, bool fromBindingContextChanged)
582 var prop = _properties.ToArray();
583 for (int i = 0, propLength = prop.Length; i < propLength; i++) {
584 BindablePropertyContext context = prop [i];
585 BindingBase binding = context.Binding;
589 if (skipBindingContext && ReferenceEquals(context.Property, BindingContextProperty))
592 binding.Unapply(fromBindingContextChanged: fromBindingContextChanged);
593 binding.Apply(BindingContext, this, context.Property, fromBindingContextChanged: fromBindingContextChanged);
597 static void BindingContextPropertyBindingChanging(BindableObject bindable, BindingBase oldBindingBase, BindingBase newBindingBase)
599 object context = bindable._inheritedContext;
600 var oldBinding = oldBindingBase as Binding;
601 var newBinding = newBindingBase as Binding;
603 if (context == null && oldBinding != null)
604 context = oldBinding.Context;
605 if (context != null && newBinding != null)
606 newBinding.Context = context;
609 static void BindingContextPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
611 bindable._inheritedContext = null;
612 bindable.ApplyBindings(skipBindingContext: true, fromBindingContextChanged:true);
613 bindable.OnBindingContextChanged();
616 void ClearValue(BindableProperty property, bool fromStyle, bool checkAccess)
618 if (property == null)
619 throw new ArgumentNullException(nameof(property));
621 if (checkAccess && property.IsReadOnly)
622 throw new InvalidOperationException(string.Format("The BindableProperty \"{0}\" is readonly.", property.PropertyName));
624 BindablePropertyContext bpcontext = GetContext(property);
625 if (bpcontext == null)
628 if (fromStyle && !CanBeSetFromStyle(property))
631 object original = bpcontext.Value;
633 object newValue = property.GetDefaultValue(this);
635 bool same = Equals(original, newValue);
638 property.PropertyChanging?.Invoke(this, original, newValue);
640 OnPropertyChanging(property.PropertyName);
643 bpcontext.Attributes &= ~BindableContextAttributes.IsManuallySet;
644 bpcontext.Value = newValue;
645 if (property.DefaultValueCreator == null)
646 bpcontext.Attributes |= BindableContextAttributes.IsDefaultValue;
648 bpcontext.Attributes |= BindableContextAttributes.IsDefaultValueCreated;
652 OnPropertyChanged(property.PropertyName);
653 property.PropertyChanged?.Invoke(this, original, newValue);
657 [MethodImpl(MethodImplOptions.AggressiveInlining)]
658 BindablePropertyContext CreateAndAddContext(BindableProperty property)
660 var context = new BindablePropertyContext { Property = property, Value = property.DefaultValueCreator != null ? property.DefaultValueCreator(this) : property.DefaultValue };
662 if (property.DefaultValueCreator == null)
663 context.Attributes = BindableContextAttributes.IsDefaultValue;
665 context.Attributes = BindableContextAttributes.IsDefaultValueCreated;
667 _properties.Add(context);
671 [MethodImpl(MethodImplOptions.AggressiveInlining)]
672 BindablePropertyContext GetContext(BindableProperty property)
674 List<BindablePropertyContext> properties = _properties;
676 for (var i = 0; i < properties.Count; i++)
678 BindablePropertyContext context = properties[i];
679 if (ReferenceEquals(context.Property, property))
686 [MethodImpl(MethodImplOptions.AggressiveInlining)]
687 BindablePropertyContext GetOrCreateContext(BindableProperty property)
689 BindablePropertyContext context = GetContext(property);
692 context = CreateAndAddContext(property);
694 else if (property.DefaultValueCreator != null )
696 context.Value = property.DefaultValueCreator(this); //Update Value from dali
702 void RemoveBinding(BindableProperty property, BindablePropertyContext context)
704 context.Binding.Unapply();
706 property.BindingChanging?.Invoke(this, context.Binding, null);
708 context.Binding = null;
711 void SetValue(BindableProperty property, object value, bool fromStyle, bool checkAccess)
713 if (property == null)
714 throw new ArgumentNullException("property");
716 if (checkAccess && property.IsReadOnly)
717 throw new InvalidOperationException(string.Format("The BindableProperty \"{0}\" is readonly.", property.PropertyName));
719 if (fromStyle && !CanBeSetFromStyle(property))
722 SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearDynamicResource,
723 (fromStyle ? SetValuePrivateFlags.FromStyle : SetValuePrivateFlags.ManuallySet) | (checkAccess ? SetValuePrivateFlags.CheckAccess : 0),
727 void SetValueActual(BindableProperty property, BindablePropertyContext context, object value, bool currentlyApplying, bool forceSendChangeSignal, SetValueFlags attributes, bool silent = false)
729 object original = context.Value;
730 bool raiseOnEqual = (attributes & SetValueFlags.RaiseOnEqual) != 0;
731 bool clearDynamicResources = (attributes & SetValueFlags.ClearDynamicResource) != 0;
732 bool clearOneWayBindings = (attributes & SetValueFlags.ClearOneWayBindings) != 0;
733 bool clearTwoWayBindings = (attributes & SetValueFlags.ClearTwoWayBindings) != 0;
735 bool same = ReferenceEquals(context.Property, BindingContextProperty) ? ReferenceEquals(value, original) : Equals(value, original);
736 if (!silent && (!same || raiseOnEqual))
738 property.PropertyChanging?.Invoke(this, original, value);
740 OnPropertyChanging(property.PropertyName);
743 if (!same || raiseOnEqual)
745 context.Value = value;
748 context.Attributes &= ~BindableContextAttributes.IsDefaultValue;
749 context.Attributes &= ~BindableContextAttributes.IsDefaultValueCreated;
751 if ((context.Attributes & BindableContextAttributes.IsDynamicResource) != 0 && clearDynamicResources)
752 RemoveDynamicResource(property);
754 BindingBase binding = context.Binding;
757 if (clearOneWayBindings && binding.GetRealizedMode(property) == BindingMode.OneWay || clearTwoWayBindings && binding.GetRealizedMode(property) == BindingMode.TwoWay)
759 RemoveBinding(property, context);
766 if ((!same || raiseOnEqual))
768 property.PropertyChanged?.Invoke(this, original, value);
770 if (binding != null && !currentlyApplying)
777 OnPropertyChanged(property.PropertyName);
779 else if (true == same && true == forceSendChangeSignal)
781 if (binding != null && !currentlyApplying)
788 OnPropertyChanged(property.PropertyName);
794 enum BindableContextAttributes
796 IsManuallySet = 1 << 0,
798 IsDynamicResource = 1 << 2,
799 IsSetFromStyle = 1 << 3,
800 IsDefaultValue = 1 << 4,
801 IsDefaultValueCreated = 1 << 5,
804 class BindablePropertyContext
806 public BindableContextAttributes Attributes;
807 public BindingBase Binding;
808 public Queue<SetValueArgs> DelayedSetters;
809 public BindableProperty Property;
814 internal enum SetValuePrivateFlags
817 CheckAccess = 1 << 0,
819 ManuallySet = 1 << 2,
822 Default = CheckAccess
827 public readonly SetValueFlags Attributes;
828 public readonly BindablePropertyContext Context;
829 public readonly bool CurrentlyApplying;
830 public readonly BindableProperty Property;
831 public readonly object Value;
833 public SetValueArgs(BindableProperty property, BindablePropertyContext context, object value, bool currentlyApplying, SetValueFlags attributes)
838 CurrentlyApplying = currentlyApplying;
839 Attributes = attributes;
845 namespace Tizen.NUI.Binding.Internals
848 /// SetValueFlags. For internal use.
851 [EditorBrowsable(EditorBrowsableState.Never)]
852 public enum SetValueFlags
857 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
858 [EditorBrowsable(EditorBrowsableState.Never)]
862 /// Clear OneWay bindings.
864 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
865 [EditorBrowsable(EditorBrowsableState.Never)]
866 ClearOneWayBindings = 1 << 0,
869 /// Clear TwoWay bindings.
871 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
872 [EditorBrowsable(EditorBrowsableState.Never)]
873 ClearTwoWayBindings = 1 << 1,
876 /// Clear dynamic resource.
878 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
879 [EditorBrowsable(EditorBrowsableState.Never)]
880 ClearDynamicResource = 1 << 2,
885 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
886 [EditorBrowsable(EditorBrowsableState.Never)]
887 RaiseOnEqual = 1 << 3