Esempio n. 1
0
        private static void OnValueChanged(DependencyObject depObj, DependencyPropertyChangedEventArgs e)
        {
            BindingSlave slave = depObj as BindingSlave;

            Debug.Assert(slave != null);
            slave.OnPropertyChanged("Value");
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a BindingSlave for each Binding and binds the Value
        /// accordingly.
        /// </summary>
        internal void Initialise(FrameworkElement targetElement)
        {
            Children.Clear();
            foreach (Binding binding in Bindings)
            {
                BindingSlave slave;

                // create a binding slave instance
                if (!string.IsNullOrEmpty(binding.ElementName))
                {
                    // create an element name binding slave, this slave will resolve the
                    // binding source reference and construct a suitable binding.
                    slave = new ElementNameBindingSlave(targetElement, binding);
                }
                else
                {
                    slave = new BindingSlave();
                    slave.SetBinding(BindingSlave.ValueProperty, binding);
                }
                slave.PropertyChanged += SlavePropertyChanged;
                Children.Add(slave);
            }
        }