TextBox

Editable text input with caret, selection, and placeholder support.

Overview

The TextBox control extends Control and provides a full-featured editable text input. It supports single-line mode (default) and multi-line mode when AcceptsReturn is true. Features include caret navigation, text selection (Shift+Arrow), clipboard operations (Ctrl+C/V/X), word-level navigation (Ctrl+Arrow), and placeholder text.

<!-- Single-line TextBox with placeholder -->
<TextBox Text="{Binding InputText, Mode=TwoWay}"
         PlaceholderText="Type something here..."
         TabIndex="0" />

<!-- Read-only TextBox -->
<TextBox Text="{Binding OutputText}" IsReadOnly="True" />

<!-- Multi-line TextBox -->
<TextBox AcceptsReturn="True"
         PlaceholderText="Enter notes here..."
         TabIndex="2" />

ViewModel (C#)

public class TextInputViewModel : ViewModelBase
{
    public string InputText
    {
        get;
        set
        {
            if (SetProperty(ref field, value))
            {
                StatusText = $"Characters: {value?.Length ?? 0}";
                OutputText = $"Echo: {value}";
            }
        }
    } = "";

    public string StatusText { get; set => SetProperty(ref field, value); }
    public string OutputText { get; set => SetProperty(ref field, value); }
    public string NotesText  { get; set => SetProperty(ref field, value); }
}

Key Concepts