How to make password box non-editable in wpf

.net, c#, wpf

Solution

You can handle the `PreviewTextInput` event, preventing the user from entering text. Like so:

Xaml:

<PasswordBox PreviewTextInput="HandleInput"/>

Codebehind:

private void HandleInput(object sender, TextCompositionEventArgs e) {
  e.Handled = true;
}

Problem

I need to make password box as non-editable in wpf. I used IsEnabled = false But it is affecting my style some blur effect came because of that... Is there any other way to achieve this ?

Original source

Related problems