I'm just getting started with M-V-VM and WPF and having issues understanding some binding issues.
I have a login page that has a ComboBox and PasswordBox. The ComboBox looks like this:
<ComboBox Name="comboBox1" SelectedItem="{Binding Path=Username}">
This works just fine - my values get updated everytime the SelectedItem changes on the ComboBox!
In my ViewModel I have an ICommand which uses this method to determine if the Login button is active:
public bool CanLogin()
{
return !string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password);
}
So my problem is I don't have the PasswordBox bound to the Password property on the ViewModel - so I have no way to tell when it is updated.
So how do I get the value of the PasswordBox to my ViewModel? Everything I've read just says don't bind a PasswordBox for security reasons. I would simply take off the password restriction on the CanLogin() but I need the value to pass along to an AccountService.