Ejemplo n.º 1
0
        /// <summary>
        /// Run validation rules for the given step
        /// <summary>
        internal override bool Validate(object value, ValidationStep validationStep)
        {
            BindingExpressionBase bindExpr = ActiveBindingExpression;

            if (bindExpr != null)
            {
                return(bindExpr.Validate(value, validationStep));
            }
            return(true);
        }
Ejemplo n.º 2
0
        // Token: 0x06001C2E RID: 7214 RVA: 0x000844B0 File Offset: 0x000826B0
        private bool ConvertProposedValueImpl(object value, out object result)
        {
            DependencyObject targetElement = base.TargetElement;

            if (targetElement == null)
            {
                result = DependencyProperty.UnsetValue;
                return(false);
            }
            result = this.GetValuesForChildBindings(value);
            if (base.IsDetached)
            {
                return(false);
            }
            if (result == DependencyProperty.UnsetValue)
            {
                base.SetStatus(BindingStatusInternal.UpdateSourceError);
                return(false);
            }
            object[] array = (object[])result;
            if (array == null)
            {
                if (TraceData.IsEnabled)
                {
                    TraceData.Trace(TraceEventType.Error, TraceData.BadMultiConverterForUpdate(new object[]
                    {
                        this.Converter.GetType().Name,
                        AvTrace.ToStringHelper(value),
                        AvTrace.TypeName(value)
                    }), this);
                }
                result = DependencyProperty.UnsetValue;
                return(false);
            }
            if (TraceData.IsExtendedTraceEnabled(this, TraceDataLevel.Transfer))
            {
                for (int i = 0; i < array.Length; i++)
                {
                    TraceData.Trace(TraceEventType.Warning, TraceData.UserConvertBackMulti(new object[]
                    {
                        TraceData.Identify(this),
                        i,
                        TraceData.Identify(array[i])
                    }));
                }
            }
            int num = this.MutableBindingExpressions.Count;

            if (array.Length != num && TraceData.IsEnabled)
            {
                TraceData.Trace(TraceEventType.Information, TraceData.MultiValueConverterMismatch, new object[]
                {
                    this.Converter.GetType().Name,
                    num,
                    array.Length,
                    TraceData.DescribeTarget(targetElement, base.TargetProperty)
                });
            }
            if (array.Length < num)
            {
                num = array.Length;
            }
            bool result2 = true;

            for (int j = 0; j < num; j++)
            {
                value = array[j];
                if (value != Binding.DoNothing && value != DependencyProperty.UnsetValue)
                {
                    BindingExpressionBase bindingExpressionBase = this.MutableBindingExpressions[j];
                    bindingExpressionBase.SetValue(targetElement, base.TargetProperty, value);
                    value = bindingExpressionBase.GetRawProposedValue();
                    if (!bindingExpressionBase.Validate(value, ValidationStep.RawProposedValue))
                    {
                        value = DependencyProperty.UnsetValue;
                    }
                    value = bindingExpressionBase.ConvertProposedValue(value);
                }
                else if (value == DependencyProperty.UnsetValue && TraceData.IsEnabled)
                {
                    TraceData.Trace(TraceEventType.Information, TraceData.UnsetValueInMultiBindingExpressionUpdate(new object[]
                    {
                        this.Converter.GetType().Name,
                        AvTrace.ToStringHelper(value),
                        j,
                        this._tempTypes[j]
                    }), this);
                }
                if (value == DependencyProperty.UnsetValue)
                {
                    result2 = false;
                }
                array[j] = value;
            }
            Array.Clear(this._tempTypes, 0, this._tempTypes.Length);
            result = array;
            return(result2);
        }
        // Token: 0x06001C7F RID: 7295 RVA: 0x00085FD8 File Offset: 0x000841D8
        internal override bool Validate(object value, ValidationStep validationStep)
        {
            BindingExpressionBase activeBindingExpression = this.ActiveBindingExpression;

            return(activeBindingExpression == null || activeBindingExpression.Validate(value, validationStep));
        }