Custom Label Text

Hi,
I want to display the MQTT device status in a Label field.
The device is a switch that returns either ON or OFF. It’s straight forward to display ON or OFF in the text field.
But the switch is connected to a door, so I would rather like to display OPEN or CLOSED (instead of ON/OFF).
Any idea how to go about?
Thanks,
Mike

Add 2 DataTriggers to the Label. One for each possible value, ON & OFF.

Add a Setter to the DataTrigger that sets the Text property to either OPEN or CLOSED.

See screenshot below. Attached is an example I wrote for you.
Mike_CustomLabel.hrp (7.6 KB)

Thanks a lot, Bill. It works perfectly now.

1 Like