I am very new to WPF and C# in general. I am trying to add a textholder on my textbox, when you focus on the textbox, i want the text to disappear, and if I move to something else (aka loses focus), and the text is empty, i want the textbox to add the text I want the text back.
but I get error on GotFocus.EventHandle(RemoveText); and LostFocus.EventHandle(AddText); on the words "GotFocus" and "Lostfocus" (on the code below)
what am I missing?
I tried this next code:
ExcelPath.Text = "Please Drag Excel into here";
ExcelPath.GotFocus += GotFocus.EventHandle(RemoveText);
ExcelPath.LostFocus += LostFocus.EventHandle(AddText);
public void RemoveText(object sender, EventArgs e)
{
if (ExcelPath.Text == "Please Drag Excel into here")
{
ExcelPath.Text = "";
}
}
public void AddText(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(ExcelPath.Text))
ExcelPath.Text = "Please Drag Excel into here";
}