Csharp_Snippets/StyleFunctions/Textbox_Hint_Text.cs

18 lines
510 B
C#

class Textbox_Hint_Text
{
TextBox textboxs = new TextBox();
private void textbox_MouseEnter(object sender, MouseEventArgs e)
{
textboxs.Text = "";
textboxs.Foreground = Brushes.White;
}
private void textbox_MouseLeave(object sender, MouseEventArgs e)
{
if (textboxs.Text.Length == 0)
{
textboxs.Text = "Search";
textboxs.Foreground = Brushes.Gray;
}
}
}