示例#1
0
        internal override void RouteSetValue(
            IAvaloniaObject o,
            object value,
            BindingPriority priority)
        {
            var v = TryConvert(value);

            if (v.HasValue)
            {
                o.SetValue <TValue>(this, (TValue)v.Value);
            }
            else if (v.Type == BindingValueType.UnsetValue)
            {
                o.ClearValue(this);
            }
            else if (v.HasError)
            {
                throw v.Error !;
            }
        }
示例#2
0
        /// <inheritdoc/>
        internal override IDisposable?RouteSetValue(
            IAvaloniaObject o,
            object?value,
            BindingPriority priority)
        {
            var v = TryConvert(value);

            if (v.HasValue)
            {
                return(o.SetValue <TValue>(this, (TValue)v.Value !, priority));
            }
            else if (v.Type == BindingValueType.UnsetValue)
            {
                o.ClearValue(this);
            }
            else if (v.HasError)
            {
                throw v.Error !;
            }

            return(null);
        }
示例#3
0
 /// <inheritdoc/>
 internal override void RouteClearValue(IAvaloniaObject o)
 {
     o.ClearValue <TValue>(this);
 }