Esempio n. 1
0
        private void SetSourcePropertyBinding(bool shouldRaiseOnSourcePropertyValueChanged)
        {
            var binding = new Windows.UI.Xaml.Data.Binding
            {
                Converter          = Converter, ConverterLanguage = ConverterLanguage,
                ConverterParameter = ConverterParameter, ElementName = ElementName,
                FallbackValue      = FallbackValue, Mode = Mode,
                Path            = Path, RelativeSource = RelativeSource,
                Source          = Source, UpdateSourceTrigger = UpdateSourceTrigger,
                TargetNullValue = TargetNullValue
            };

            using (DisableableSourceValueChangedCallback.Disable())
            {
                BindingOperations.SetBinding(this, SourcePropertyValueProperty, binding);
            }

            if (shouldRaiseOnSourcePropertyValueChanged)
            {
                OnSourcePropertyValueChanged();
            }
        }
Esempio n. 2
0
        private void CreateOneWayToSourceBinding()
        {
            switch (UpdateSourceTrigger)
            {
            case UpdateSourceTrigger.Default:
            case UpdateSourceTrigger.PropertyChanged:
                using (DisableableTargetPropertyValueChangedCallback.Disable())
                {
                    var binding = new Windows.UI.Xaml.Data.Binding {
                        Source = this, Path = new PropertyPath(TargetPropertyValuePropertyName), Mode = BindingMode.TwoWay
                    };
                    BindingOperations.SetBinding(_associatedObject, _dependencyPropertyDescriptor.DependencyProperty, binding);
                }
                break;

            case UpdateSourceTrigger.Explicit:
                break;

            default:
                throw new InvalidOperationException("Unknown UpdateSourceTrigger mode.");
            }
        }