Share via


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.

Because the update to TextBox will not happen until a future version of Silverlight feel free download and use the WatermarkedTextBox source code and unit test in the mean time. By downloading the source and unit tests you accept the license.

Here is an example on how to use it:

image

 

image

For more information on how to use this control, check out our Beta1 documentation in MSDN:

https://msdn.microsoft.com/en-us/library/system.windows.controls.watermarkedtextbox(VS.95).aspx

In additional to porting the source code & unit test for Beta 1, we also did the following:

  • Updated the template to use new features in the framework (i.e. VisualStateManager)
  • Bug fixing: When the control has focus, MouseOver state will no longer be active after moving the mouse away from the cotnrol
  • Bug fixing: Allow setting BorderBrush correctly

If you run into any problems, let me know! :)

<Editorial Note>
This is also a great example on how to use the new Visual State Manager for Silverlight 2 Beta 2!
Also a special "Thank you" to the WatermarkedTextBox dev Alex Bulankou for porting the source code, updating & fixing the bugs.
</Editorial Note>

Comments

  • Anonymous
    June 23, 2008
    PingBack from http://wordnew.acne-reveiw.info/?p=2206

  • Anonymous
    June 24, 2008
    One breaking change you may have noticed between Silverlight 2 Beta 1 and Beta 2 is that WatermarkedTextBox

  • Anonymous
    June 24, 2008
    Just a quick note that one of the breaking changes from beta 2 was that the WatermarkedTextBox control

  • Anonymous
    June 24, 2008
    With Silverlight 2 Beta 2 coming out there were a number of changes that will break applications written

  • Anonymous
    June 24, 2008
    One breaking change you may have noticed between Silverlight 2 Beta 1 and Beta 2 is that WatermarkedTextBox

  • Anonymous
    June 24, 2008
    Kathy, one quick question: When you say "Future version of SL" do you mean like SL 3 or are we still talking version 2? Thanks! ..Ben

  • Anonymous
    June 24, 2008
    Hi Ben, "future" means some future version after SL 2. Thanks, Kathy

  • Anonymous
    June 24, 2008
    Hope watermark is available on similar controls like ComboBox - this could be exposed via control template or attached property like ToolTip.

  • Anonymous
    June 24, 2008
    Silverlight 2.0: La desaparecida WatermarkedTextBox

  • Anonymous
    June 24, 2008
    Hi Kathy, I previously upgraded the control for Silverlight 2 beta 2 as well (http://craign.net/2008/06/10/watermarkedtextbox-control-for-silverlight-2-beta-2/) however I never took advantage of the VSM. Are you going to update the control to use the DefaultStyle and generic.xaml so that it can be styled using a future build of Blend? I was about to blog the updated code when I saw your post on it. Would you like a copy of my changes perhaps?

  • Anonymous
    June 24, 2008
    Dans la Beta 1 de Silverlight 2 , on disposait d'un contrôle bien sympathique nommé WatermarkTextBox.

  • Anonymous
    June 25, 2008
    Emil Stoychev with a Silverlight Twitter Widget, Kathy Kam on the missing WatermarkedTextBox, Adam Kinney

  • Anonymous
    July 03, 2008
    Kathy, Thanks for providing the same, but i guess we will have to either copy the source code into our projects, or rename the assembly, as it otherwise conflicts with the released System.Windows.Controls.Extended assembly which I would use to work with controls inside of it.

  • Anonymous
    July 03, 2008
    Silverlight WatermarkedTextBox control code

  • Anonymous
    July 17, 2008
    작년 12월에 Silverlight 1.0 애플리케이션 맛보기 개발에 대한 글을 쓴 적이 있다. 어제 새벽 2시 정도에 잠을 깨는 바람에 Silverlight 2 애플리케이션 개발을 위한 튜터리얼을 보면서 실제로 개발하는 과정을 체험해보았다. Silverlight 1.0은 Javascript 만을 지원했고, GUI 애플리케이션 개발을 위한 라이브러리에 기본적으로 포함되어있는 레이아웃이나 컨트롤(위젯)들을 포함하고 있지 않았기 때문에, 이렇다 할

  • Anonymous
    August 08, 2008
    How can I System.Windows.Controls in silverlight 2 beta 2.

  • Anonymous
    August 12, 2008
    How does this work now? Source code sln file opens with errors. I'm trying to follow Scott Guthrie's silverlight tutorial.. but I can't do it with this. AARGH.

  • Anonymous
    August 17, 2008
    Why you don't built a watermarkedtextbox .dll file cause when I download the zip file above I can't build it, they said it's not my currently using version!

  • Anonymous
    October 14, 2008
    The System.Windows.Controls.Extended.Test project misses a reference to the System.Windows.Controls.Extended project. After adding the reference, the solution builds!

  • Anonymous
    October 15, 2008
    The comment has been removed

  • Anonymous
    October 15, 2008
    Hi~ I tried using that. But it isn't working. Could you explain to use that control in Silverlight 2 RTW(2.0.31005.0)? I want to use that control. Please~

  • Anonymous
    October 16, 2008
    For all who tried to get the WatermarkedTextBox assembly to work with Silverlight 2.0 RTW: You have to change the "Duration" property of the VisualTransition class in the WatermarkedTextBox.xaml of the project to "GeneratedDuration" - then it will work. Cheers Zazi

  • Anonymous
    October 20, 2008
    Silverlight.net updated code samples

  • Anonymous
    October 20, 2008
    With the release of Silverlight 2 many people faced the task of ensuring their applications/code written

  • Anonymous
    January 10, 2009
    The comment has been removed

  • Anonymous
    January 10, 2009
    There are tons of problems with this code. Even after I correct the problems that users kindly posted in comments, it does not run. The Test project snags on two Assert statements. You also give no information here on how to reference the controls built here. It's a really inadequate article with buggy code. You chose not to post my previous comment. Fine - you don't like criticism. But then at least fix the problem. Post instructions on how to fix the bugs, or post updated code, and add information on references the dlls in a new project. A newbie is not going to know this. Thank you for not censoring.

  • Anonymous
    January 12, 2009
    The comment has been removed

  • Anonymous
    March 22, 2009
    Hi Kathy, I'm currently having Silverlight 3 beta version isntalled for development. I dont find any property as WaterMark for a textbox.

  • Harshad
  • Anonymous
    April 03, 2009
    Hello Kathy, thanks for help us! ;) But i have a problem becouse i am learning to use silverlight and i don't know what to do with the watermarkedtextbox.zip. Where does it go? In which directory i have to install it? Thank you very much for your help!!

  • Anonymous
    April 17, 2009
    Just playing with SL3 Beta, but still can't find the Watermark property. Am i missing something?

  • Anonymous
    April 27, 2009
    The above watermark assembly doesn't work anymore. Do a search in the System.Windows.Controls.Extended project for "VisualTransition". You'll get 4 results, change the "Duration" attribute on each to "GeneratedDuration".

  • Anonymous
    July 09, 2009
    yes Alter the 4 Duration to GeneratedDuration and build the System.Windows.Controls.Extended project and on your project you can have the watermarked work fine.