示例#1
0
        internal void OnSourcePropertyChanged(object o, string propName)
        {
            int level;

            // ignore changes that don't affect this binding.
            // This test must come before any marshalling to the right context (bug 892484)
            if (!IgnoreSourcePropertyChange && (level = PW.LevelForPropertyChange(o, propName)) >= 0)
            {
                // if notification was on the right thread, just do the work (normal case)
                if (Dispatcher.Thread == Thread.CurrentThread)
                {
                    PW.OnPropertyChangedAtLevel(level);
                }
                else
                {
                    // otherwise invoke an operation to do the work on the right context
                    SetTransferIsPending(true);

                    if (ParentBindingExpression.TargetWantsCrossThreadNotifications)
                    {
                        LiveShapingItem lsi = TargetElement as LiveShapingItem;
                        if (lsi != null)
                        {
                            lsi.OnCrossThreadPropertyChange(TargetProperty);
                        }
                    }

                    Engine.Marshal(
                        new DispatcherOperationCallback(ScheduleTransferOperation),
                        null);
                }
            }
        }