bool applying;
object inheritedContext;
- private object bindingContext;
-
/// <summary>
/// Gets or sets object that contains the properties that will be targeted by the bound properties that belong to this BindableObject.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public int LinePosition { get; set; } = -1;
- void IDynamicResourceHandler.SetDynamicResource(BindableProperty property, string key)
- {
- SetDynamicResource(property, key, false);
- }
+ void IDynamicResourceHandler.SetDynamicResource(BindableProperty property, string key) => SetDynamicResource(property, key, false);
/// <summary>
/// Raised when a property has changed.
{
nameToBindableProperty2.TryGetValue(keyValuePair.Key, out var bindableProperty);
- if (null != bindableProperty && (ChangedPropertiesSet.Contains(bindableProperty) || other.ChangedPropertiesSet.Contains(bindableProperty)))
+ if (null != bindableProperty && other.IsSet(bindableProperty))
{
object value = other.GetValue(bindableProperty);
-
- if (null != value)
- {
- InternalSetValue(keyValuePair.Value, value);
- }
+ InternalSetValue(keyValuePair.Value, value);
}
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler BindingContextChanged;
- internal void ClearValue(BindableProperty property, bool fromStyle)
- {
- ClearValue(property, fromStyle: fromStyle, checkAccess: true);
- }
+ internal void ClearValue(BindableProperty property, bool fromStyle) => ClearValue(property, fromStyle: fromStyle, checkAccess: true);
/// <summary>
/// Clears any value set by Tizen.NUI.Xaml.BindableObject.SetValue.
if (property == null)
throw new ArgumentNullException(nameof(property));
- if (!IsBinded && property.ValueGetter != null)
+ if (!IsBound && property.ValueGetter != null)
{
return property.ValueGetter(this);
}
/// Removes a previously set binding.
/// </summary>
/// <param name="property">The BindableProperty from which to remove bindings.</param>
- internal void RemoveBinding(BindableProperty property)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveBinding(BindableProperty property)
{
if (property == null)
throw new ArgumentNullException(nameof(property));
/// <param name="binding">The binding to set.</param>
/// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- public void SetBinding(BindableProperty targetProperty, BindingBase binding)
- {
- SetBinding(targetProperty, binding, false);
- }
+ public void SetBinding(BindableProperty targetProperty, BindingBase binding) => SetBinding(targetProperty, binding, false);
/// Internal used, will never changed to not hidden.
[EditorBrowsable(EditorBrowsableState.Never)]
- public bool IsCreateByXaml
+ public virtual bool IsCreateByXaml
{
get;
set;
internal void InternalSetValue(BindableProperty property, object value)
{
- if (true == IsBinded)
+ if (true == IsBound)
{
SetValue(property, value, false, true);
}
}
object oldvalue = null;
- if (null == property.DefaultValueCreator)
- {
- BindablePropertyContext context = GetOrCreateContext(property);
- if (null != context)
- {
- oldvalue = context.Value;
- context.Value = value;
- }
- }
- else
+ BindablePropertyContext context = GetOrCreateContext(property);
+ if (null != context)
{
- oldvalue = property.DefaultValueCreator.Invoke(this);
+ context.Attributes |= BindableContextAttributes.IsManuallySet;
+ oldvalue = context.Value;
+ context.Value = value;
}
+ property.PropertyChanging?.Invoke(this, oldvalue, value);
property.PropertyChanged?.Invoke(this, oldvalue, value);
OnPropertyChanged(property.PropertyName);
OnPropertyChangedWithData(property);
}
-
- ChangedPropertiesSet.Add(property);
- }
-
- private HashSet<BindableProperty> changedPropertiesSet;
- private HashSet<BindableProperty> ChangedPropertiesSet
- {
- get
- {
- if (null == changedPropertiesSet)
- {
- changedPropertiesSet = new HashSet<BindableProperty>();
- }
-
- return changedPropertiesSet;
- }
}
private HashSet<BindableProperty> changedPropertiesSetExcludingStyle;
/// </summary>
/// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- protected void ApplyBindings()
- {
- ApplyBindings(skipBindingContext: false, fromBindingContextChanged: false);
- }
+ protected void ApplyBindings() => ApplyBindings(skipBindingContext: false, fromBindingContextChanged: false);
/// <summary>
/// Override this method to execute an action when the BindingContext changes.
if (fromStyle && !CanBeSetFromStyle(targetProperty))
return;
- IsBinded = true;
+ IsBound = true;
var context = GetOrCreateContext(targetProperty);
if (fromStyle)
return false;
}
- internal void SetDynamicResource(BindableProperty property, string key)
- {
- SetDynamicResource(property, key, false);
- }
+ internal void SetDynamicResource(BindableProperty property, string key) => SetDynamicResource(property, key, false);
internal void SetDynamicResource(BindableProperty property, string key, bool fromStyle)
{
OnSetDynamicResource(property, key);
}
- internal void SetValue(BindableProperty property, object value, bool fromStyle)
- {
- SetValue(property, value, fromStyle, true);
- }
+ internal void SetValue(BindableProperty property, object value, bool fromStyle) => SetValue(property, value, fromStyle, true);
internal void SetValueCore(BindablePropertyKey propertyKey, object value, SetValueFlags attributes = SetValueFlags.None)
{
/// <param name="value">The value to set</param>
/// <param name="attributes">The set value flag</param>
[EditorBrowsable(EditorBrowsableState.Never)]
- internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes = SetValueFlags.None)
- {
- SetValueCore(property, value, attributes, SetValuePrivateFlags.Default);
- }
+ internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes = SetValueFlags.None) => SetValueCore(property, value, attributes, SetValuePrivateFlags.Default);
internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
{
}
}
+ /// <summary>
+ /// Check if object is bound or not.
+ /// This API used for legacy codes.
+ /// Should be removed after all app usage replaced into IsBound.
+ /// </summary>
+ [Obsolete("This has been deprecated in API11. Use IsBound property instead.")]
internal bool IsBinded
{
+ get
+ {
+ return IsBound;
+ }
+ set
+ {
+ IsBound = value;
+ }
+ }
+
+ /// <summary>
+ /// Check if object is bound or not.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsBound
+ {
get;
set;
} = false;
if (newvalue is BindableObject targetBindableObject)
{
- targetBindableObject.IsBinded = true;
+ targetBindableObject.IsBound = true;
}
}
}
}
- internal void ClearBinding()
+ /// <summary>
+ /// Unapplies all previously set bindings.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ClearBinding()
{
foreach (var property in properties)
{