3

The effect I want to achieve is a "lead text" in an input field. As soon as you click the column (to start writing), the current text should disappear.

I have two attributes: one Name, and one InitialName. InitialName is a Derived attribute that is a hard coded string. When creating a new object of this type, Name:=InitialName will be executed and therefore displayed in the text box.

I have created an action in the view model that sets Name to String.nullValue if Name=InitialName. Since actions can be rendered by other columns, I tried setting RenderedBy to the Name-column.

In short terms: my idea was to set the current Name to null as soon as you click the column it is displayed in (if the name hadn't been changed), but this gave no effect. Is this possible to do? Or is there any other way to achieve desired effect?

Milo
  • 3,365
  • 9
  • 30
  • 44
f.sandberg
  • 31
  • 1

1 Answers1

2

I think this would be much better solved by applying a style to the ViewModelColumn and have the WPF style render the hint when the TextBox is empty.

Look at the accepted answer on this question: How can I add a hint text to WPF textbox?

Hans Karlsen
  • 2,275
  • 1
  • 15
  • 15