Arun
Arun

Reputation: 3456

How to get a color of a control in windows phone 7

I have a button in my windows phone app. I setted its foreground color as "Red". I want to get this color to check if it is red I need to change it to blue.

How can I get the foreground color of a control (here it is button) ?

Thanks, Stallin

Upvotes: 0

Views: 155

Answers (1)

abhinav
abhinav

Reputation: 3217

The foreground is basically a Brush object. You can get the object by,

var colorbrush = mybutton.Foreground as Brush;

colorbrush should contain the object. See documentation to extract or change the color of this object.

Upvotes: 3

Related Questions