My PasswordBox is bound to the ViewModel like:
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
.
.
.
<PasswordBox x:Name="pwbox" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="PasswordChanged" >
<i:InvokeCommandAction Command="{Binding PasswordChangedCommand }" CommandParameter="{Binding ElementName=pwbox, Mode=OneWay}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</PasswordBox>
And in the view model:
public ICommand PasswordChangedCommand { get; private set; }
private string password;
public MyVMClass()
{
PasswordChangedCommand = new RelayCommand<object>(PasswordChangedMethod);
}
private void PasswordChangedMethod(object obj)
{
password = ((System.Windows.Controls.PasswordBox)obj).Password;
}
It works fine in one way, i.e If I enter the password inside view, I can access it from the viewmodel, my question: how can I bound the password to the other way, i.e if I change it via ViewModel I want to see the change in the view.