private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     PasswordContentControl.ApplyTemplate();
     passwordBoxControl = PasswordContentControl.Template.FindName("GlobalPasswordTextBox", PasswordContentControl) as PasswordBox;
     textBoxControl     = PasswordContentControl.Template.FindName("ShowTextBox", PasswordContentControl) as TextBox;
     showHideImage      = PasswordContentControl.Template.FindName("ShowPasswordCharsCheckBox", PasswordContentControl) as ToggleButton;
     if (passwordBoxControl != null)
     {
         passwordBoxControl.Focus();
     }
 }
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     PasswordContentControl.ApplyTemplate();
     GlobalPasswordTextBox = PasswordContentControl.Template.FindName("GlobalPasswordTextBox", PasswordContentControl) as PasswordBox;
 }