c# - How to check for the current background color of a grid? -


i'm trying make toggle button change background color of windows phone 7 app.

i'm changing background color of grid named layoutroot using code:

layoutroot.background = new solidcolorbrush(colors.white); 

after i've done that, want check value of layoutroot.background in if statement (to serve toggle). i'm running problems. can't seem come way check value.

when layoutroot.background.tostring(), system.windows.media.solidbrushcolor value. suppose makes sense, since background solidbrushcolor. how access value, can check in if statement?

you can do:

solidcolorbrush brush = layoutroot.background solidcolorbrush; if (brush != null) {     if (brush.color == colors.white) {         //     } } 

other possible brushes include lineargradientbrush , radialgradientbrush, solidcolorbrush 1 of many possible brush types. why there if-statement checking null.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -