How to get text from "PasswordBox"?

So, I watched the second post on this answer link from FMM. He clearly explains what he is doing, but I would like to know more about how to use this in the Model view. I gave it an exit, but passwordBoxreturns null in my login method. How to pass a password as a parameter to my login button?

In my loginView.xaml

<Button x:Name="Login"/>
<PasswordBox  x:Name="PasswordBox" materialDesign:HintAssist.Hint="Password"/>

In my LoginViewModel.cs

public void Login(PasswordBox passwordBox)
{
    // I want to get the password box 
    passwordString = passwordBox.password;
    MessageBox.Show(passwordString);
}
0
source share

All Articles