Esempio n. 1
0
        public PriorityValue(
            IAvaloniaObject owner,
            StyledPropertyBase <T> property,
            IValueSink sink,
            IPriorityValueEntry <T> existing)
            : this(owner, property, sink)
        {
            existing.Reparent(this);
            _entries.Add(existing);

            if (existing is IBindingEntry binding &&
                existing.Priority == BindingPriority.LocalValue)
            {
                // Bit of a special case here: if we have a local value binding that is being
                // promoted to a priority value we need to make sure the binding is subscribed
                // even if we've got a batch operation in progress because otherwise we don't know
                // whether the binding or a subsequent SetValue with local priority will win. A
                // notification won't be sent during batch update anyway because it will be
                // caught and stored for later by the ValueStore.
                binding.Start(ignoreBatchUpdate: true);
            }

            var v = existing.GetValue();

            if (v.HasValue)
            {
                _value   = v;
                Priority = existing.Priority;
            }
        }
Esempio n. 2
0
 void IValueSink.Completed <TValue>(
     StyledPropertyBase <TValue> property,
     IPriorityValueEntry entry,
     Optional <TValue> oldValue)
 {
     _entries.Remove((IPriorityValueEntry <T>)entry);
     UpdateEffectiveValue();
 }
Esempio n. 3
0
 public PropertySetterInstance(
     IStyleable target,
     StyledPropertyBase <T> property,
     T value)
 {
     _target         = target;
     _styledProperty = property;
     _value          = value;
 }
 public PropertySetterTemplateInstance(
     IStyleable target,
     StyledPropertyBase <T> property,
     ITemplate template)
 {
     _target         = target;
     _styledProperty = property;
     _template       = template;
 }
Esempio n. 5
0
 public ConstantValueEntry(
     StyledPropertyBase <T> property,
     T value,
     BindingPriority priority)
 {
     Property = property;
     Value    = value;
     Priority = priority;
 }
 public PropertySetterLazyInstance(
     IStyleable target,
     StyledPropertyBase <T> property,
     Func <T> valueFactory)
 {
     _target         = target;
     _styledProperty = property;
     _valueFactory   = valueFactory;
 }
Esempio n. 7
0
 public PriorityValue(
     IAvaloniaObject owner,
     StyledPropertyBase <T> property,
     IValueSink sink,
     LocalValueEntry <T> existing)
     : this(owner, property, sink)
 {
     _value   = _localValue = existing.GetValue(BindingPriority.LocalValue);
     Priority = BindingPriority.LocalValue;
 }
Esempio n. 8
0
 public ConstantValueEntry(
     StyledPropertyBase <T> property,
     [AllowNull] T value,
     BindingPriority priority,
     IValueSink sink)
 {
     Property = property;
     _value   = value;
     Priority = priority;
     _sink    = sink;
 }
 public void Completed(StyledPropertyBase <T> property, IPriorityValueEntry entry, Optional <T> oldValue)
 {
     if (_store is not null)
     {
         _store?.Completed(property, entry, oldValue);
     }
     else
     {
         _priorityValue !.Completed(entry, oldValue);
     }
 }
Esempio n. 10
0
 public ConstantValueEntry(
     StyledPropertyBase <T> property,
     Optional <T> value,
     BindingPriority priority,
     IValueSink sink)
 {
     Property = property;
     _value   = value;
     Priority = priority;
     _sink    = sink;
 }
Esempio n. 11
0
 public ConstantValueEntry(
     StyledPropertyBase <T> property,
     T value,
     BindingPriority priority,
     ValueOwner <T> sink)
 {
     Property = property;
     _value   = value;
     Priority = priority;
     _sink    = sink;
 }
Esempio n. 12
0
        void IValueSink.ValueChanged <TValue>(
            StyledPropertyBase <TValue> property,
            BindingPriority priority,
            Optional <TValue> oldValue,
            BindingValue <TValue> newValue)
        {
            if (priority == BindingPriority.LocalValue)
            {
                _localValue = default;
            }

            UpdateEffectiveValue();
        }
Esempio n. 13
0
 public BindingEntry(
     IAvaloniaObject owner,
     StyledPropertyBase <T> property,
     IObservable <BindingValue <T> > source,
     BindingPriority priority,
     IValueSink sink)
 {
     _owner   = owner;
     Property = property;
     Source   = source;
     Priority = priority;
     _sink    = sink;
 }
        public PriorityValue(
            AvaloniaObject owner,
            StyledPropertyBase <T> property,
            ValueStore store)
        {
            _owner   = owner;
            Property = property;
            _store   = store;

            if (property.HasCoercion)
            {
                var metadata = property.GetMetadata(owner.GetType());
                _coerceValue = metadata.CoerceValue;
            }
        }
Esempio n. 15
0
        public PriorityValue(
            IAvaloniaObject owner,
            StyledPropertyBase <T> property,
            IValueSink sink)
        {
            _owner   = owner;
            Property = property;
            _sink    = sink;

            if (property.HasCoercion)
            {
                var metadata = property.GetMetadata(owner.GetType());
                _coerceValue = metadata.CoerceValue;
            }
        }
Esempio n. 16
0
        public PriorityValue(
            IAvaloniaObject owner,
            StyledPropertyBase <T> property,
            IValueSink sink,
            IPriorityValueEntry <T> existing)
            : this(owner, property, sink)
        {
            existing.Reparent(this);
            _entries.Add(existing);

            if (existing.Value.HasValue)
            {
                Value         = existing.Value;
                ValuePriority = existing.Priority;
            }
        }
Esempio n. 17
0
        public PropertySetterBindingInstance(
            IStyleable target,
            StyledPropertyBase <T> property,
            IBinding binding)
        {
            _target         = target;
            _styledProperty = property;
            _binding        = binding.Initiate(_target, property);

            if (_binding.Mode == BindingMode.OneTime)
            {
                // For the moment, we don't support OneTime bindings in setters, because I'm not
                // sure what the semantics should be in the case of activation/deactivation.
                throw new NotSupportedException("OneTime bindings are not supported in setters.");
            }

            _inner = new Inner(this);
        }
 public void Completed <T>(StyledPropertyBase <T> property, IPriorityValueEntry entry, Optional <T> oldValue)
 {
 }