Posts from February 2010

Feb
7
2010

Watermarked TextBox with an AttachedProperty



Posted in Programming and WPF

Ever wanted to create a watermark effect for a TextBox in WPF? Most of the tutorials scattered around have either used static text or created a subclass of TextBox. I wanted to use an AttachedProperty instead, and though it took a while to try every possible combination of brackets and bindings I came up with the following to create an AttachedProperty which you can apply in any ResourceDictionary or wherever you keep your Styles.


Watermarks with Attached Properties
Get the code after the jump.

Read more »