PasswordBox - Bindable? #4043
-
Team, Here the project I've tried but it ends always with an empty password: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Yes it does have. Here's an example from a project of mine:
Just FYI the XAML namespaces are:
|
Beta Was this translation helpful? Give feedback.
-
Sorry, I don’t know, sounds more like something in your project. I’m using
MVVM and the password control is bound to a property in the View Model. The
VM is a singleton that gets injected into the logon form so I can get at
the password by looking at this.
…On Mon, 8 Feb 2021 at 10:22, Massimo Savazzi ***@***.***> wrote:
@makingbloke <https://github.com/makingbloke> I have a major issue. When
I leave the settings page and go back to the first page the password got
cancelled.
I've added some debug strings and here the outcome:
I enter the page:
BackupPassword >test<
I press 2 and add it
BackupPassword >test2<
When I press on the main page
BackupPassword ><
navigated from
So the password is always empty.
If I change the passwordBox into a textbox that does not happen
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4043 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPMCPMEBKZNUTPPW4EBSS3S563PBANCNFSM4XHX7HMQ>
.
|
Beta Was this translation helpful? Give feedback.
-
Hi @msavazzi I provided an working solution to your sample (different ViewModel as the one you provided does not run). The issue must be something else, but we are not here to solve all your issues. See: msavazzi/Mahapps.PasswordBind#2 /cc @makingbloke fyi Happy coding |
Beta Was this translation helpful? Give feedback.
Yes it does have. Here's an example from a project of mine:
<PasswordBox mahControls:PasswordBoxHelper.CapsLockWarningToolTip="Caps Lock is on" mahControls:TextBoxHelper.Watermark="Password" mahShared:PasswordBoxBindingBehavior.Password="{Binding Password, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, Mode=TwoWay}" />
Notice the MahApps PasswordBoxBindingBehaviour is used to bind the password to a Password string property in my ViewModel.
Just FYI the XAML namespaces are:
xmlns:mahControls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:mahShared="http://metro.mahapps.com/winfx/xaml/shared"