Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

c# WPF Button Background Color with Thread

$
0
0

Hello Friends,

I am designing a Quiz game, I am now facing a little problem I want to change the background of color of Button for few time. I am using this code:

public void myMethod()

{

  if (textbox.Text == "WHAT IS YOUR NAME?")
            {


                if (btnA == true)
                {
                      Thread.Sleep(3000);


                    btnAnswerA.Background = Brushes.Green;


                   Thread.Sleep(3000);
                 

                   btnAnswerA.Background = Brushes.Black;

                }

              }

}

private void btnAnswerA_Click(object sender, RoutedEventArgs e)
        {


            btnA = true;
            btnB = false;
            btnC = false;
            btnD = false;

            myMethod();
        }

Button Changes it's color but direct From Default to Black, Green color not show.

Please help Thanks.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>