0
votes

I am new to wpf and xaml,but have been reading few tutorials online and learning.I have created a textbox and added validation rule by deriving from ValidationRule class and overriding Validate method.

So in that method I make sure string entered is not empty else I return new ValidationResult(false, "Input required");

Now can I update the text value here;for example if the string is empty set it to a default value.

1

1 Answers

1
votes

Unfortunately, validation rules happens outside of the logical tree.

You can try Josh Smith's virtual branch approach.