2

Is it possible to add 'placeholder' text to WPF datagrid cells, akin to HTML's form attributes?

e.g.

<input type="text" name="fname" placeholder="First name"/>  

Firstname fades as soon as the box has content / is given focus, can never be copied, and is there just as a hint, the value is never set to first name.

I want to be able to bind it to an inherited default value, and have that value disappear as soon as it has focus, and never save the value back to the underlying view mode.

enter image description here

aybe
  • 15,516
  • 9
  • 57
  • 105
Ryan Leach
  • 4,262
  • 5
  • 34
  • 71

1 Answers1

1

The mahapps metro UI Toolkit contains a style for Textbox with Watermark (attached property)

Project site

Project Github

  • Can textbox with watermark be applied to datagrid cells without embedding a textbox inside? – Ryan Leach May 23 '18 at 09:15
  • I don't know, the watermark is an attached property used in a style that redefine the default textbox style. Maybe you can extract the style and use it for your datagrid cells style – Jonathan Perennes May 23 '18 at 09:28