예제 #1
0
 private void TerminalTargetPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     int[] bindings;
     if (_bindingNode.BindingActions.TryGetValue(e.PropertyName, out bindings))
     {
         BindingExecutor.Execute(_map, bindings);
     }
 }
예제 #2
0
        private void TargetPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            IObjectWatcher <TNode> node;
            var propertyName = e.PropertyName;

            if (_subWatchers.TryGetValue(propertyName, out node))
            {
                node.Attach(_target);
            }

            int[] bindings;
            if (_bindingNode.BindingActions.TryGetValue(propertyName, out bindings))
            {
                BindingExecutor.Execute(_map, bindings);
            }
        }
        protected virtual void TargetCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (_node.Indexes.Length > 0)
            {
                BindingExecutor.Execute(_map, _node.Indexes);
            }

            if (_node.ItemNode != null)
            {
                switch (e.Action)
                {
                case NotifyCollectionChangedAction.Add:
                {
                    AttachItem((TItem)e.NewItems[0]);
                    break;
                }

                case NotifyCollectionChangedAction.Remove:
                {
                    DetachItem((TItem)e.OldItems[0]);
                    break;
                }

                case NotifyCollectionChangedAction.Replace:
                {
                    DetachItem((TItem)e.OldItems[0]);
                    AttachItem((TItem)e.NewItems[0]);
                    break;
                }

                case NotifyCollectionChangedAction.Reset:
                {
                    DetachItems();
                    AttachItems();
                    break;
                }
                }
            }
        }