private void OnApplyTemplate() { _passwordBox.ApplyTemplate(); TextBox = _passwordBox.GetTemplateChild <TextBox>(nameof(TextBox)); if (TextBox != null) { TextBox.IsUndoEnabled = false; SpellCheck.SetIsEnabled(TextBox, false); TextBox.CommandBindings.Add(TextBoxCutBinding); TextBox.CommandBindings.Add(TextBoxCopyBinding); TextBox.TextChanged += OnTextBoxTextChanged; UpdateTextBox(); } UpdateVisualState(false); }