Displaying “Type here to …” until the user enters text into a TextBox is a well-known usability feature nowadays. How would one implement this feature in C#?
My idea is to override OnTextChanged, but the logic to handle the changes of text from and to “Type here” is a bit tricky…
Displaying “Type here” on initialization and removing it on first input is easy, but I want to display the message every time the entered text becomes empty.
What you’re looking for is a TextBox with a “watermark“.
There’s a sample implementation for C# here, all credits to Wael Alghool.
The relevant part of his code is: