PasswordBox + MVVM

Topics: Prism v4 - WPF 4
Mar 30, 2011 at 7:29 PM

I found a  workaround to get this working:

Though, it seems like there should be a cleaner way to handle this, does anyone know of a cleaner way to handle the issue of getting the password from a password box while maintaining the MVVM approach. I don't need to actually bind the password to a property, but if I can pass it in as a command parameter that would be the most ideal.

With the hack method I am binding to a property, which for some reason has it's updatetrigger to propertychanged and can't be overridden. As well, this workaround also forces you to specify the Mode=TwoWay instead of defaulting to it.

Mar 31, 2011 at 2:55 PM


You can read the following threads on WPF forums where PasswordBox, databinding and security topics are covered.

Since this is not strictly related to Prism, you might find better support on WPF forums.

I hope you find this information useful.


Miguel Bronzovic