0

I have the following in LoginView:

<TextBox x:Name="username" />
<PasswordBox x:Name="password"/>
<Button x:Name="doLogin" Content="Login"/>

And the following in LoginViewModel:

[ImplementPropertyChanged]
internal class LoginViewModel : PropertyChangedBase
{
    public string username { get; set; }
    public string password { get; set; }

    public bool CandoLogin()
    {
        return !String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password);
    }

    public void doLogin()
    {
        MessageBox.Show(username);
    }
}

Now when I enter username and password in their respective fields I expect the button to be enable but that's not happening.

Am I missing anything. Note, this is my first MVVM project and Caliburn also.

UPDATE: The problem is with the PasswordBox otherwise all the binding is working fine. Here are different references for PasswordBox binding:

MVVM PasswordBox Binding

Caliburn Micro PasswordBox Binding

Community
  • 1
  • 1
zulqarnain
  • 1,695
  • 1
  • 16
  • 33

0 Answers0