CopyTextBox

July 29, 2026 ยท View on GitHub

A Mosaic styled text box with an attached copy button that places the box's text onto the clipboard. The button shares the text box's border (drawing only its left edge) so the two read as a single control, clipboard failures are handled rather than thrown, and an optional toast notification can report whether the copy succeeded.

CopyTextBox

Key Properties

PropertyDescription
TextThe text displayed and copied to the clipboard. Two-way by default.
WatermarkPlaceholder text shown while the control is empty and unfocused.
IsReadOnlyWhether the user can edit the text.
CopyIconThe geometry rendered inside the copy button. Defaults to a copy glyph.
CopyButtonToolTipThe tool tip shown when hovering the copy button.
CornerRadiusThe corner radius of the outer border.
SelectedBorderBrushThe border brush used while the control has keyboard focus.
ShowToastShows a success/error toast after a copy. Off by default.
ToastManagerThe ToastManager to display through. Falls back to ToastManager.Default, then to a manager created over the containing window's content.
ToastQuadrant / ToastDurationWhere the toast appears and how long it stays open.
ToastSuccessTitle / ToastSuccessMessageThe success toast's text.
ToastErrorTitle / ToastErrorMessageThe failure toast's text. The OS error message is appended.
Command / CommandParameterExecuted after the copy is attempted. The parameter defaults to Text.

Events

EventDescription
TextCopiedBubbles after a copy is attempted. TextCopiedEventArgs carries the Text, whether it was Successful, and any Exception the clipboard threw.

Example

<mosaic:CopyTextBox
    Width="380"
    CornerRadius="4"
    ShowToast="True"
    Text="https://www.apexgate.net"
    Watermark="Nothing to copy" />