annaclan.blogg.se

Wpf passwordbox watermark
Wpf passwordbox watermark















Yes, technically it is code behind, but it is nothing more than a "special case" binding. This method does not violate the MVVM pattern and maintains complete security. Maybe I am missing something, but it seems like most of these solutions overcomplicate things and do away with secure practices. I put a breakpoint and sure enough the code enter the static helper class but it never updates my Password in my ViewModel. I have my TextBox, this is no problem, but in my ViewModel the Password is empty.Īm I doing something wrong or missing a step? In Login I send along to my service a Username and Password, Username contains data from my View but Password is Null|Empty private DelegateCommand loginCommand īool result = securityService.IsValidLogin(Username, Password)

wpf passwordbox watermark

You can see I check my property for Username here which works great. When I press it CanLogin is called and if it returns true it calls Login. My code is very simple, basically I have a Command for my Button. When I had the PasswordBox as a TextBox and Binding Path=Password then the property in my LoginViewModel was updated. I used the code above as stated and entered this

wpf passwordbox watermark wpf passwordbox watermark

Username is fine and is working as it's a TextBox. I basically have properties in my LoginViewModel for Username and Password.

#Wpf passwordbox watermark how to#

It technically looks great, but I am unsure of how to retrieve the password. I found some interesting code here (has anyone used this or something similar?) It seems it's a security risk but I am using the MVVM pattern so I wish to bypass this. I have come across a problem with binding to a PasswordBox.















Wpf passwordbox watermark