Ranjith Kumar

Ranjith Kumar

  • NA
  • 43
  • 361

Grid Background is not changing

Nov 14 2019 1:58 AM
I have to set the grid background based on the result. that is working fine.
 
But when I am clicking again the button, it is not set to white color. 
  1. private void Conversion_Click(object sender, RoutedEventArgs e)  
  2. {  
  3.    grid.Background = new SolidColorBrush(Colors.White);  
  4.    bool result = DoConversion();  
  5.    
  6.    if (result)  
  7.    {  
  8.          grid.Background = new SolidColorBrush(Colors.Green);  
  9.    }  
  10.    else  
  11.    {  
  12.          grid.Background = new SolidColorBrush(Colors.Red);  
  13.    }  
  14. }  

Answers (4)