protected override void UpdateTransition(AssignedStyle style)
        {
            //Debug.WriteLine("Updating transition");

            base.UpdateTransition(style);
            Element.InvalidateMeasure();
            _styleContext.CoerceIsChanged();
        }
Exemple #2
0
        protected override void OnUpdate(Double runningPct)
        {
            var currentValue = _initialValue + (_valueDifference * runningPct);
            var assigned     = new AssignedStyle(_assignedStyle.SetterType, _assignedStyle.Type,
                                                 currentValue);

            _updater(assigned);
        }
        public override void Add(StyleSetterType setterType,
                                 VisualStateType type,
                                 Object?value)
        {
            var key = new AssignedStyle(setterType, type, value);

            if (setterType == StyleSetterType.Transition)
            {
                var transitions = value as Transition[]
                                  ?? throw new ArgumentOutOfRangeException(nameof(value));

                foreach (var trans in transitions)
                {
                    var tranqui = new AssignedStyle(trans.SetterType, type, trans);
                    _transitions[tranqui] = trans;
                }
            }
            else if (_transitions.TryGetValue(key, out var transition))
            {
                if (!_setters.TryGetValue(key, out var existed))
                {
                    existed = null;
                }

                switch (value)
                {
                //case Thickness _:
                //    var runningThickness = new ThicknessTransition(existed, transition, key, UpdateTransition);
                //    runningThickness.Start();
                //    break;

                //case Double _:
                //    var running = new DoubleTransition(existed,
                //        transition, key, UpdateTransition);
                //    running.Start();
                //    break;

                default:
                    throw new NotImplementedException();
                }
            }
            else
            {
                base.Add(setterType, type, value);
            }
        }
Exemple #4
0
        public DoubleTransition(Object?initialValue,
                                Transition transition,
                                AssignedStyle assignedStyle,
                                Action <AssignedStyle> updater)
            : base(transition.Duration, transition.Delay, Easing.QuadraticOut)
        {
            Double finalValue;

            _initialValue = initialValue is Double d ? d : 0;
            if (assignedStyle.Value is Double valid)
            {
                finalValue = valid;
            }
            else
            {
                throw new NotImplementedException();
            }

            _valueDifference = finalValue - _initialValue;

            _assignedStyle = assignedStyle;
            _updater       = updater;
        }