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

Visual Studio 2012 complains about comparing two Brushes

$
0
0

Visual Studio 2012 complains about comparing two Brushes.

    private void SetLabel(string stText, Brushes colorBackground)
    {
      if (colorBackGround == Brushes.Yellow)
     ...
    }

Error msg "The name 'colorBackGround' does not exist in the current context"


cte677


Sorry about the colorBackground typo -> I had fixed it but did not copy it correctly -> too much muxing.  The correct error message is "Operator '==' cannot be applied to operands of type 'System.Windows.Media.Brushes' and 'System.Windows.Media.SolidColorBrush'"  I tried changing Brushes colorBackground to SolidColorBrush colorBackground -> it is satisfied with the "if" statement, but does not like gLBl.Background = colorBackGround -> assumed changing it to SolidColorBrush was a mistake.

Viewing all articles
Browse latest Browse all 18858

Trending Articles



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