コード例 #1
0
        protected override object Evaluate()
        {
            Tuple <object, string> o = this.RewritePath(this.ParentBinding.Path);

            this.chain = this.pathParser.Parse(o.Item1, o.Item2).ToArray();

            if (this.chain != null)
            {
                this.AttachListeners();

                PropertyPathToken last = this.chain.Last();

                if (last.Type == PropertyPathTokenType.FinalValue)
                {
                    return(last.Object);
                }
                else
                {
                    return(DependencyProperty.UnsetValue);
                }
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        private void PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            PropertyPathToken link = this.FindLinkInChain(sender);

            if (e.PropertyName == link.PropertyName)
            {
                this.DetachListeners();
                this.Invalidate();
            }
        }
コード例 #3
0
        private void DetachListener(PropertyPathToken link)
        {
            IObservableDependencyObject dependencyObject = link.Object as IObservableDependencyObject;
            INotifyPropertyChanged      inpc             = link.Object as INotifyPropertyChanged;

            if (dependencyObject != null)
            {
                dependencyObject.RemovePropertyChangedHandler(link.PropertyName, this.DependencyPropertyChanged);
            }
            else if (inpc != null)
            {
                inpc.PropertyChanged -= this.PropertyChanged;
            }
        }
コード例 #4
0
        private void DetachListener(PropertyPathToken link)
        {
            IObservableDependencyObject dependencyObject = link.Object as IObservableDependencyObject;
            INotifyPropertyChanged inpc = link.Object as INotifyPropertyChanged;

            if (dependencyObject != null)
            {
                dependencyObject.RemovePropertyChangedHandler(link.PropertyName, this.DependencyPropertyChanged);
            }
            else if (inpc != null)
            {
                inpc.PropertyChanged -= this.PropertyChanged;
            }
        }