Display some text content and disappear it after 5 seconds

  • Thread starter Thread starter zleug
  • Start date Start date
Z

zleug

Guest
Hi All.

I would like to appear text on max 5 sec in click event and then it disappear. I found this code

public void TextAppear()
{
txtDelay.Text = "Whatever";
var timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(5);
timer.Tick += delegate { txtDelay.Text = String.Empty; };
}

And insert TextAppear() in click event. When I click button text appeared but in 5 sex didn't disappear. How to fix it? Or may exist some another decision.

Thanks.

Continue reading...
 
Back
Top