WatermarkTextBox

Derives from Xceed.Wpf.Toolkit.AutoSelectTextBox

The WatermarkTextBox is simply a TextBox that allows you to specify an object, usually a String, to represent null or missing text.

Using Text

watermarktextbox.jpg

watermarktextbox_withtext.jpg
     <xctk:WatermarkTextBox Watermark="Enter First Name" />

Using an Image with Text

watermarktextbox_image.jpg
watermarktextbox_imagename.jpg
         <xctk:WatermarkTextBox>
            <xctk:WatermarkTextBox.Watermark>
                <StackPanel Orientation="Horizontal">
                    <Image Source="Contact16.png" Stretch="None" />
                    <TextBlock Text="Enter First Name" Margin="4,0,0,0" />
                </StackPanel>
            </xctk:WatermarkTextBox.Watermark>
        </xctk:WatermarkTextBox>    

Custom WatermarkTemplate

watermarktextbox_template.jpg
        <xctk:WatermarkTextBox Watermark="Enter First Name">
            <xctk:WatermarkTextBox.WatermarkTemplate>
                <DataTemplate>
                    <Border BorderBrush="Green" BorderThickness="1">
                        <ContentControl Content="{Binding}" Foreground="DarkRed" FontWeight="Bold" Focusable="False" />
                    </Border>
                </DataTemplate>
            </xctk:WatermarkTextBox.WatermarkTemplate>
        </xctk:WatermarkTextBox>   

Properties

Property Description
AutoMoveFocus Gets or sets a value indicating if the focus can navigate in the appropriate flow direction (e.g., from one cell to another when a cell is being edited) when the cursor is at the beginning or end of the auto-select text box. (Inherited from AutoSelectTextBox)
AutoSelectBehavior Gets or sets a value indicating how the content of the auto-select text box is selected (Never or OnFocus). By default, Never. (Inherited from AutoSelectTextBox)
Watermark Gets or sets the object to use in place of null or missing Text.
WatermarkTemplate Gets or sets the DataTemplate to use to display the Watermark.


Support this project, check out the Plus Edition.
---

Last edited Jun 9 at 5:47 PM by dlafontaine, version 11

Comments

shenglingshi Jul 4 at 3:32 AM 
Need a passwordbox like WatermarkTextBox

BoucherS Nov 5, 2013 at 12:58 PM 
Please enter an issue in the issue panel.

sonhuytran Nov 5, 2013 at 10:20 AM 
Is there any possibility that I can set password character to this WatermarkTextBox ?

JakubPawlinski Jun 13, 2013 at 1:27 PM 
missing similar passwordbox :(

jogibear9988 Oct 23, 2011 at 7:20 PM 
Found a nice AutoComplete Textbox based on this Control: http://www.mycsharp.de/wbb2/thread.php?threadid=98510 (it supports Phonetic algorithms)