0

A ComboBox.SelectedItemProperty is bound TowWay to a DependencyProperty in The Control.

In the ControlTemplate :

  <ComboBox IsEditable="True">
     <ComboBox.SelectedItem>
          <Binding RelativeSource="{RelativeSource TemplatedParent}" 
                   Path="SomeDP" Mode="TwoWay" NotifyOnValidationError="True">
              <Binding.ValidationRules>
                 <vld:DeleteAfterInitValidationRule  ValidatesOnTargetUpdated="True" />
              </Binding.ValidationRules>
          </Binding>
     </ComboBox.SelectedItem>
  </ComboBox>

When the ValidationRule returns false

   return ValidationResult(false,msg);

The Dependency Property bound to selected item is not updated.

Is there a way to force the binding to update the source ?

*Please if any one is going to raise a discussion here about

BindingExpression.UpdateSource() , please supply a working example, and not just blurt it out because it sounds like the solution , i do not intend to use Explicit mode on my Binding.

Further more i can easily code my way around this but a good .net programmer should thrive to write less code and use the built in mechanisms supplied by the .net framework ,

And that is the soul purpose of this question , is there a built in way of updating the source while notifying of a DataError ?

eran otzap
  • 12,293
  • 20
  • 84
  • 139

0 Answers0