How can I add watermark text to a textbox in wpf?

后端 未结 3 1149
不思量自难忘°
不思量自难忘° 2021-01-20 03:50

Im working on a wpf application.How I can add watermark text to the textbox and passwordbox?



        
3条回答
  •  醉酒成梦
    2021-01-20 04:01

    Take a look at this SO Question. The second answer of creating an Attached Property is what I would suggest.

    There are also some extended WPF controls that can help: http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox

    Edit: Added Extended WPF Toolkit link.

提交回复
热议问题