Create WPF Watermark in Pure XAML
c#, wpf, xaml
Solution
Find the below samples help you to find your way.
http://bendewey.wordpress.com/2008/09/27/wpf-shadowed-textbox-watermark/
http://www.c-sharpcorner.com/uploadfile/rahul4_saxena/watermark-textbox-in-wpf/
http://www.codeproject.com/Articles/26977/A-WatermarkTextBox-in-3-lines-of-XAML
Problem
This is for a TextBox control on a login screen, where the TextBox contains the username. I want the TextBox to perform in the following way: When the content is empty the content should be set to "Username". When the TextBox is clicked I want the content to be set to "" i.e; nothing (unless the content has already been edited by the user). This is a pretty standard feature nowadays, something like this wordpress login (at the top of page). coudn't think of a better example than this I'm afraid :) So, anyway, I've already done this using a ViewModel and it works well, but I'd like to know if this can be done purely from the XAML end. No business logic is concerned so I think it would be better to do it without the VM.