WatermarkedTextBox for Silverlight 2 Beta 2


One breaking change you may have noticed between Silverlight 2 Beta 1 and Beta 2 is that WatermarkedTextBox is no longer available in the Silverlight SDK (System.Windows.Controls.Extended.dll). 

We decided to remove the control because in a future version of Silverlight, we will be adding a “Watermark” property to TextBox. Given this upcoming change, it does not make sense to have "WatermarkedTextBox" as a separate control, so we decided to remove the control from Silverlight 2.

Kathy has all the details on her blog, but you can download the WatermarkedTextBox source code and unit test here.  

Comments (7)

  1. Hi Brad!  Thanks for the head up on removing the watermarked text box.  When you say that in a future version you will have a watermark property of the textbox, would it be safe to assume that in the final Silverlight 2 version the watermark property will be there.  Or do you suspect we’ll be waiting longer than that?

    Thanks for your blog, I always read your updates!

  2. Patrick says:

    Hi Brad,

    I think a better solution would have be to remove TextBox and rename WatermarkedTextBox to TextBox. With little change, we will still have a watermarked text box.

  3. Silverlight 2.0: La desaparecida WatermarkedTextBox

  4. AndyL says:

    Several attendees at a recent meeting of the local .Net Users Group were complaining about the lack of this control, and were also very surprised to hear that you can duplicate it with just 3 lines of Xaml (a TextBlock whose visibility is bound to the IsEmpty property of an overlaid transparent TextBox).  It won’t satisfy everyone (no separate disabled visual style, for example), but many devs seem to find this solution perfectly adequate for their needs.  Many devs often automatically assume they need to write code-behind when a little Xaml might serve just as well.  The related issue of knowing when you’ve begun to cross over the border into Xaml abuse is also probably going to be an interesting code maintenance topic at alot of dev. shops going forward.

    http://www.codeproject.com/KB/WPF/WatermarkTextBox.aspx

  5. Dave Friedel says:

    Thank you…  I would prefer they build out the text box to include a masked property as well.  They could even kill the password box – and allow us the ability to set that option.

  6. Matt says:

    Sorry for bringing that up again, but in my opinion

    "[…] a TextBlock whose visibility is bound to the IsEmpty property of an overlaid transparent TextBox […]" is just dirty and I prefer to drop the feature than to implement it that way.

    Cheers,

    Matt