I have:
private void button1_MouseEnter(object sender, EventArgs e)
{
for (int i = 0; i > 2; i++)
{
button1.Content = Convert.ToString(i
Hi is your for loop correct? It should be i<2 instead of i>2
for (int i = 0; i < 2; i++)
{
Your for loop never execute because you have wrong condition, change it to following code:
for (int i = 0; i < 2; i++)
Also you should use BackgroundWorker
(msdn) to update your GUI dynamicly.
private void button1_MouseEnter(object sender, MouseEventArgs e)
{
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += delegate
{
for (int i = 0; i < 2; i++)
{
this.Dispatcher.Invoke((Action)(() => { btn.Content = Convert.ToString(i); }));
System.Threading.Thread.Sleep(1000);
}
};
worker.RunWorkerCompleted += delegate { tekst.Text = "Mouse Enter"; };
worker.RunWorkerAsync();
}