Leave the code cleaner than you found it
private void TextBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
First, define below variables at class level string_enteredPasscode=""; string_passwordChar="*"