Esempio n. 1
0
 private void TargetBindingChanged(DependencyPropertyChangedEventArgs args)
 {
     if (args.NewValue != _targetBinding)
     {
         TargetBinding = _targetBinding;
     }
 }
Esempio n. 2
0
        private void Init()
        {
            if (Element == null)
            {
                _targetBinding = null;
                TargetBinding  = _targetBinding;
                return;
            }

            _targetBinding = IndirectProperty <TType> .Create(Element, _propertyPath);

            TargetBinding = _targetBinding;
        }
        private void Init()
        {
            if (Element == null || PropertyPath == null || ChangedEventPath == null)
            {
                _indirectProperty = null;

                TargetBinding = default(TType);
                return;
            }

            try
            {
                if (subscribedDelegate != null)
                {
                    try
                    {
                        EventProxy.Unsubscribe(subscribedEventElement, subscribedEventInfo, subscribedDelegate);
                    }
                    finally
                    {
                        subscribedDelegate     = null;
                        subscribedEventInfo    = null;
                        subscribedEventElement = null;
                    }
                }

                _indirectProperty = IndirectProperty <TType> .Create(Element, PropertyPath);

                var evt  = ReflectionPathResolver.GetEvent(Element, ChangedEventPath);
                var dlgt = EventProxy.Subscribe(evt.Item1, evt.Item2, OnProxyChangedEvent);

                subscribedDelegate     = dlgt;
                subscribedEventInfo    = evt.Item2;
                subscribedEventElement = evt.Item1;

                TargetBinding = _indirectProperty.Get();
            }
            catch (Exception)
            {
                _indirectProperty = null;
            }
        }