Change background of a button with scripting

Hi,

I’ve three buttons, each button shows a layer and hides the other two. What I need is to change the style of the active button (e.g. background color), does anybody know how to do this?

Thanks.

Put a script like

button1.background = new dundas.controls.SolidColorBrush('red'); button2.background = new dundas.controls.SolidColorBruth('gray');

on each button, where ‘button1’ is the active button, and ‘button2’ is the inactive one.

1 Like

There are three main colour properties with the button (Down,Rest and Hover) just in case you are looking to do a bit more.

button1.hoverBackground = new dundas.controls.SolidColorBrush(‘green’);
button1.downBackground = new dundas.controls.SolidColorBrush(‘purple’);
button1.restBackground = new dundas.controls.SolidColorBrush(‘blue’);

1 Like

Thanks Jeff. That’s exactly what I needed!

Thanks David. I used the solution @jeff appointed, just because it’s more complete and it changes all the possible events of the button!

Yup - go with Jeff I would say :slight_smile:

1 Like