ValidationRule::ValidatesOnTargetUpdated Property
.NET Framework (current version)
Gets or sets a value that indicates whether the validation rule runs when the target of the Binding is updated.
Assembly: PresentationFramework (in PresentationFramework.dll)
The following example checks whether the TextBox is empty. The ValidationRule, ValueIsNotNull, has ValidatesOnTargetUpdated set to true, so that when the application starts, the ValidationRule runs and displays a message if the TextBox is empty.
<TextBox Width="150" Validation.Error="ItemError"> <TextBox.Text> <Binding Source="{StaticResource myObject}" Path="PropertyB" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True"> <Binding.ValidationRules> <src:ValueIsNotNull ValidatesOnTargetUpdated="True" /> </Binding.ValidationRules> </Binding> </TextBox.Text> </TextBox>
The following example shows the ValidationRule that is used in the previous example and the event handler for the Error event.
.NET Framework
Available since 3.0
Available since 3.0
Show: