示例#1
0
        /// <summary>
        /// Will ensure events aren't triggered when value is set
        /// </summary>
        /// <param name="propertyPath"></param>
        /// <param name="value"></param>
        internal void SetValue(string[] propertyPath, object value, BindingRegistration bindingRegistrationToSkipNotifying, PropertyInfoAndObject preObtainedSourceProperty = null)
        {
            var property = preObtainedSourceProperty ?? GetProperty(propertyPath);

            if (property != null)
            {
                BindingHost bindingHost = null;
                InternalBindingRegistration internalRegistrationToSkip = null;
                if (bindingRegistrationToSkipNotifying != null)
                {
                    internalRegistrationToSkip = bindingRegistrationToSkipNotifying.GetFinalInternalRegistration();
                    bindingHost = FindBindingHost(propertyPath);
                    if (bindingHost != null)
                    {
                        bindingHost._bindingRegistrationToSkipOnce = internalRegistrationToSkip;
                    }
                }

                try
                {
                    property.PropertyInfo.SetValue(property.Object, value);
                }
                finally
                {
                    if (bindingHost != null && bindingHost._bindingRegistrationToSkipOnce == internalRegistrationToSkip)
                    {
                        bindingHost._bindingRegistrationToSkipOnce = null;
                    }
                }
            }
        }
示例#2
0
 /// <summary>
 /// Will ensure this binding registration's callback isn't triggered when value is set
 /// </summary>
 /// <param name="propertyPath"></param>
 /// <param name="value"></param>
 public void SetSourceValue(object value, PropertyInfoAndObject preObtainedSourceProperty = null)
 {
     BindingHost.SetValue(_fullPropertyPath, value, IsEmptyRegistration ? null : this, preObtainedSourceProperty: preObtainedSourceProperty);
 }