Beispiel #1
0
        // called by the child XmlBindingWorker when an xml change is detected
        // but the identity of raw value has not changed.
        internal void OnXmlValueChanged()
        {
            // treat this as a property change at the top level
            object item = PW.GetItem(0);

            OnSourcePropertyChanged(item, null);
        }
Beispiel #2
0
        void ReplaceDependencySources()
        {
            if (!ParentBindingExpression.IsDetaching)
            {
                int size = PW.Length;
                if (PW.NeedsDirectNotification)
                {
                    ++size;
                }

                WeakDependencySource[] newSources = new WeakDependencySource[size];
                int n = 0;

                if (IsDynamic)
                {
                    for (int k = 0; k < PW.Length; ++k)
                    {
                        DependencyProperty dp = PW.GetAccessor(k) as DependencyProperty;
                        if (dp != null)
                        {
                            DependencyObject d = PW.GetItem(k) as DependencyObject;
                            if (d != null)
                            {
                                newSources[n++] = new WeakDependencySource(d, dp);
                            }
                        }
                    }

                    if (PW.NeedsDirectNotification)
                    {
                        // subproperty notifications can only arise from Freezables
                        // (as of today - 11/14/08), so we only need to propagate
                        // them when the raw value is a Freezable.
                        DependencyObject d = PW.RawValue() as Freezable;
                        if (d != null)
                        {
                            newSources[n++] = new WeakDependencySource(d, DependencyObject.DirectDependencyProperty);
                        }
                    }
                }

                ParentBindingExpression.ChangeWorkerSources(newSources, n);
            }
        }
Beispiel #3
0
        internal override void UpdateValue(object value)
        {
            int    k    = PW.Length - 1;
            object item = PW.GetItem(k);

            if (item == null || item == BindingExpression.NullDataItem)
            {
                return;
            }

            // if the binding is async, post a request to set the value
            if (ParentBinding.IsAsync && !(PW.GetAccessor(k) is DependencyProperty))
            {
                RequestAsyncSetValue(item, value);
                return;
            }

            PW.SetValue(item, value);
        }
Beispiel #4
0
 // called by the child XmlBindingWorker to get the current "result node"
 internal object GetResultNode()
 {
     return(PW.GetItem(0));
 }