I have a PasswordBox
<PasswordBox
MaxLength="12"
PlaceholderText="Password"
Foreground="Black"
Background="#eeeeee"/>
And I want to change the PlaceholderForeground color like I would on a regular TextBox but there is no property like that and after searching through the internet I found no solution that A worked for me B I understood, all the xaml code was too lengthy with style and resources of 50 lines all for such a simple property change I don't know why WPF has to be so overly complicated for no reason
Can anybody sugguest a solution that is possibly not 50 lines of xaml code that simply changes the foreground color of the placeholder text in the PasswordBox.
You can't change the placeholder color without creating something custom. But there are workarounds without huge snippets of XAML markup.
The easiest way that came to my mind is creating a custom control that derives from
PasswordBox. You'll only have to overrideOnRender:Call
base.OnRenderCheck that there's no text in the password box, and it isn't focused
Create a
FormattedTextobject, maybe like this:If you don't want any extra code, the only way I know is using third-party libraries, e.g. MahApps.Metro.
You can also create a custom behavior for the built-in
PasswordBox, though it's not much simpler than a custom control.