protected void SetBinding(string nameOfValueProperty) { var binding = new Binding(); binding.Source = this; binding.Path = new PropertyPath(nameOfValueProperty); binding.Mode = BindingMode.TwoWay; _converter = new QuantityWithUnitConverter(this, SelectedQuantityProperty); binding.Converter = _converter; binding.ValidationRules.Add(_converter); _converter.BindingExpression = this.SetBinding(ComboBox.TextProperty, binding); var dpd = System.ComponentModel.DependencyPropertyDescriptor.FromProperty(ComboBox.TextProperty, typeof(DimensionfulQuantityImageComboBox)); dpd.AddValueChanged(this, QuantityWithUnitTextBox_TextChanged); var childs = this.LogicalChildren; }
protected void SetBinding(string nameOfValueProperty) { var binding = new Binding { Source = this, Path = new PropertyPath(nameOfValueProperty), Mode = BindingMode.TwoWay }; _converter = new QuantityWithUnitConverter(this, SelectedQuantityProperty); binding.Converter = _converter; binding.ValidationRules.Add(_converter); _converter.BindingExpression = SetBinding(ComboBox.TextProperty, binding); var dpd = System.ComponentModel.DependencyPropertyDescriptor.FromProperty(ComboBox.TextProperty, typeof(DimensionfulQuantityImageComboBox)); dpd.AddValueChanged(this, QuantityWithUnitTextBox_TextChanged); var childs = LogicalChildren; }