Watermark Textbox in your Windows Phone 7 app

by thomas 26. June 2011 11:24

kick it on DotNetKicks.com

Watermark textboxes are used everywhere in standard Windows Phone 7 apps. It allows you to gain space by putting the label associated with the textbox directly inside it.

image

Unfortunately, Silverlight for Windows Phone 7 doesn’t support this kind of controls by default.

Here is a small free open-source library that just do that. You can find it here: http://watermarktextbox.codeplex.com/

To use it, you just need to add the following line in the attributes of your XAML file:

xmlns:watermark="clr-namespace:System.Windows.Controls;assembly=WindowsPhoneWatermarkTextBoxControl"

After that, you can just use this control like a standard textbox:

<watermark:WatermarkTextBox x:Name="nameTextBox" WatermarkText="Name" Text="{Binding Name}" />

Tags:

WP7 | Silverlight

Pingbacks and trackbacks (1)+

Month List