Is there a way to hide the cursor in a WPF textbox? I know there is Cursor="None" but that only affects the mouse cursor. I want to hide the "text cursor".
Caret is the current insert position in a text editor. Cursor is the shape of the mouse cursor.
There is no way to disable the caret in a read-write TextBox. Instead, change the CaretBrush to be transparent.
TextBox txt = ...;
// Hide the caret.
txt.CaretBrush = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
// Show the caret.
txt.CaretBrush = null; // use default Brush
You can colour the cursor the same colour as the background or Transparent
using the TextBox.CaretBrush
property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With