views:

305

answers:

2

I'm aware that you can't Bind to PasswordBox.Password in WPF. How do I handle a form that contains one? All other controls on the form are bound to properties on a business object, but I have to manually set and retrieve a password property whenever the input changes.

I know that others have created custom controls that allow binding to this property, but, on the other hand, Microsoft explicitly disallows binding to this property for a reason.

Are there any elegant solutions to this problem, or am I stuck writing code to bridge the gap between my form and my business object?

+1  A: 

I believe this is a repeat of this.

Which had an answer provided here.

Darien Ford
That might do the trick. Haven't tried it yet, but I probably will today. Thanks!
Pwninstein
A: 

Just bind to PasswordBox itself, i.e. {Binding ElementName=MyPasswordBox}.

Vladislav Borovikov