HypernovaDesktop Components · docs
Binarymission
WPF › Smart Text Box

Smart Text Box

.NET Framework 4.8.NET 6 / 8 / 10v2.0.0WPF

A text box with a watermark prompt, a button that clears it, an optional flag that shows whether a required value has been given, and a filter on what can be typed.

2public types
31public members
1namespaces

Assembly

AssemblyBinarymission.WPF.Controls.SmartTextBox.dll
Root namespaceBinarymission.WPF.Controls.InputControls
Target frameworks.NET Framework 4.8, .NET 6 / 8 / 10
Depends onSkinning

Overview

It is a TextBox, so TextBox.Text, binding, validation and the keyboard all work as usual; it adds four things.

The colours of the watermark, the clear button and the border come from the theme; while a Binarymission skin is applied through BinarySkinManager it supplies them, and a brush set on the box itself still wins.

Getting started

A required reference field and a quantity field. The assembly is Binarymission.WPF.Controls.SmartTextBox.

<Window x:Class="Orders.NewOrderWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:smart="clr-namespace:Binarymission.WPF.Controls.InputControls;assembly=Binarymission.WPF.Controls.SmartTextBox"
        Title="New order" Width="420" Height="200">

    <Window.Resources>
        <BitmapImage x:Key="RequiredFlag" UriSource="/Images/Required.png" />
        <BitmapImage x:Key="DoneTick" UriSource="/Images/Done.png" />
    </Window.Resources>

    <StackPanel Margin="16">
        <smart:SmartTextBox Width="240" Height="26" HorizontalAlignment="Left"
                            WatermarkContent="Customer reference"
                            Text="{Binding CustomerReference, UpdateSourceTrigger=PropertyChanged}"
                            DataEntryMode="None"
                            DisallowedInputRegularExpression="[^A-Za-z0-9-]"
                            IsAlertClueImageRenderingEnabled="True"
                            AlertClueImageSourceOnError="{StaticResource RequiredFlag}"
                            AlertClueImageSource="{StaticResource DoneTick}"
                            AlertFlagToolTipContent="A customer reference is required." />

        <smart:SmartTextBox Width="100" Height="26" Margin="0,12,0,0" HorizontalAlignment="Left"
                            WatermarkContent="Quantity"
                            DataEntryMode="NumericOnly" />
    </StackPanel>
</Window>

API reference

Binarymission.WPF.Controls.InputControls

class SmartTextBoxA text box with a watermark prompt, a button that clears it, an optional flag that shows whether a required value has been given, and a filter on what can be typed.
enum SmartTextBoxDataEntryModeWhat a SmartTextBox lets the user type or paste.