/// <summary> /// Sets the source value for the the specified <paramref name="details"/> /// </summary> internal void SetSourceValue(DependencyPropertyDetails details, object value) { details.SetSourceValue(value); if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) { this.Log().DebugFormat("Set binding value [{0}] from [{1}].", details.Property.Name, _ownerType); } }
private void OnDependencyPropertyChanged(DependencyPropertyDetails propertyDetails, DependencyPropertyChangedEventArgs args) { SetBindingValue(propertyDetails, args.NewValue); var(hasValueInherits, hasValueDoesNotInherit) = GetPropertyInheritanceConfiguration(propertyDetails); if (!hasValueDoesNotInherit && (hasValueInherits || propertyDetails.Property.HasAutoDataContextInherit)) { if (args.NewValue is IDependencyObjectStoreProvider provider) { _childrenBindable[GetOrCreateChildBindablePropertyIndex(propertyDetails.Property)] = provider.Store.Parent != ActualInstance ? args.NewValue : null; } else { _childrenBindable[GetOrCreateChildBindablePropertyIndex(propertyDetails.Property)] = args.NewValue; } } }
/// <summary> /// Creates an instance using the specified DependencyObject <see cref="Type"/> /// </summary> /// <param name="ownerType">The owner type</param> public DependencyPropertyDetailsCollection(Type ownerType, DependencyProperty dataContextProperty, DependencyProperty templatedParentProperty) { _ownerType = ownerType; var propertiesForType = DependencyProperty.GetPropertiesForType(ownerType); var entries = new PropertyEntry[propertiesForType.Length]; for (int i = 0; i < propertiesForType.Length; i++) { entries[i].Id = propertiesForType[i].UniqueId; } // Entries are pre-sorted by the DependencyProperty.GetPropertiesForType method AssignEntries(entries, sort: false); // Prefecth known properties for faster access DataContextPropertyDetails = GetPropertyDetails(dataContextProperty); TemplatedParentPropertyDetails = GetPropertyDetails(templatedParentProperty); }
/// <summary> /// Sets the specified source <paramref name="value"/> on <paramref name="property"/> /// </summary> internal void SetBindingValue(DependencyPropertyDetails propertyDetails, object value) { _properties.SetSourceValue(propertyDetails, value); }