### Style Button Red Green

Example Subroutine colouring a ToggleButton depending its state.
The same can be used for a Button.
The colour is set using the CSSUtils library.
`Sub ToggleButton_SelectedChange(Selected As Boolean)
Dim tb As ToggleButton = Sender
If Selected Then
' Button is selected, then change to red
CSSUtils.SetBackgroundColor(tb, fx.Colors.Red)
tb.Text = "OFF"
Label1.Text = $"${tb.Tag} Button switched ON, press to turn OFF"$
Else
' Button is NOT selected, then change to green
CSSUtils.SetBackgroundColor(tb, fx.Colors.Green)
tb.Text = "ON"
Label1.Text = $"${tb.Tag} Button switched OFF, press to turn ON"$
End If
End Sub`

Changed: , Category: Buttons, File: T6C167M1239.htm, ID: 1239