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>
{
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);
}
}
}
if (property == null)
throw new ArgumentNullException(nameof(property));
- if (!IsBinded && property.ValueGetter != null)
+ if (!IsBound && property.ValueGetter != null)
{
return property.ValueGetter(this);
}
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.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;
if (fromStyle && !CanBeSetFromStyle(targetProperty))
return;
- IsBinded = true;
+ IsBound = true;
var context = GetOrCreateContext(targetProperty);
if (fromStyle)
}
}
- internal bool IsBinded
+ /// <summary>
+ /// Check if object is bound or not.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsBound
{
get;
set;
if (newvalue is BindableObject targetBindableObject)
{
- targetBindableObject.IsBinded = true;
+ targetBindableObject.IsBound = true;
}
}