Exemple #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;
            }
        }
Exemple #2
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;
            }
        }