I have custom ValidationRule that returns can error when the entered text is too short. This works fine for a standard TextBox because the Text property can be bound to a source and then the rule added to the binding. When the user enters a string that is too short the rule is run and the control indicates the validation problem by showing a red border around the control.
But the PasswordControl, for security reasons, does not allow the Password field to be data bound. So instead I hook into the lost focus event and then manually create and run the ValidationRule to see if there is a problem. But there is no public method on the Validate that allows me to add the error to the collection of validation errors for the control. Is it possible to update the Validate.Errors collection manually? If not is there a way to tell the PasswordControl to show in the error state?
you can use the Attached property system for this.
have a look at below article. hopefully helps you.
http://blog.functionalfun.net/2008/06/wpf-passwordbox-and-data-binding.html