How can I do this in XAML:
PSEUDO-CODE:
<TextBox Text="{Binding Password}" Type="Password"/>
so that the user sees stars or dots when he is typing in the password.
I've tried various examples which suggest PasswordChar and PasswordBox but can't get these to work.
e.g. I can do this as shown here:
<PasswordBox Grid.Column="1" Grid.Row="1"
PasswordChar="*"/>
but I of course want to bind the Text property to my ViewModel so I can send the value the bound TextBox when the button is clicked (not working with code behind), I want to do this:
<TextBox Grid.Column="1" Grid.Row="0"
Text="{Binding Login}"
Style="{StaticResource FormTextBox}"/>
<PasswordBox Grid.Column="1" Grid.Row="1"
Text="{Binding Password}"
PasswordChar="*"
Style="{StaticResource FormTextBox}"/>
But PasswordBox doesn't have a Text property.
To get or set the Password in a PasswordBox, use the Password property. Such as
string password = PasswordBox.Password;
This doesn't support Databinding as far as I know, so you'd have to set the value in the codebehind, and update it accordingly.