Quantcast
Channel: wpftoolkit Wiki Rss Feed
Viewing all articles
Browse latest Browse all 892

Updated Wiki: WatermarkTextBox

$
0
0

WatermarkTextBox

The WatermarkTextBox is simply a TextBox that allows you to sepcify 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 / Events

Property Description
SelectAllOnGotFocus Gets or sets a value indicating whether the entire displayed text will be selected when the control gets focus.
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.


Get 50+ awesome WPF controls in the Plus Edition.
---

Viewing all articles
Browse latest Browse all 892

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>