views:

35

answers:

1

I'm new to MVVM in silverlight. It's a bit confusing because although I get the general idea, there are so many different situations where the method is not very straight forward. Here's one of them:

I have a custom text box which when set to blank shows a grayed message 'enter your text here'. The problem is, when binding to my view model I do not want the text value on the backend to be 'enter your text here', but want it to be blank. But if the user inputs ANYthing, the 'enter your text here' goes away and the backend should contain whatever the user has input. So basically it seems like this is CONDITIONAL binding.

What is the best way to go about something like this?

Thanks!

A: 

It's not a conditional binding it's a watermarktextbox this things can be implemented with attached behaviors and styles.

Chen Kinnrot
Thanks. I believe that it works because the 'text' property is actually different than the watermark that is shown -made possible by a custom content template of the textbox. Is that right?
Rob Smith
yes, thats right, this watermark ability has many implementation samples, you can check them on google and choose what you like the most. you can even use converter from empty to your water mark text.
Chen Kinnrot