Change the color of an icon at a given temperature

Hello, I’m trying to make the color of a Tile icon (TemperatureSensorTile.xaml) change color above a certain temperature. Is this possible?

1 Like

Yes. You can add a DataTrigger that changes the Background when the Temperature is within a certain range. Refer to the link below that shows how regular expressions / regex can be used to create numeric ranges.

For example, in screenshot below I have the tile configured so that the Background on the root Grid will change to Red when the temperature is between 70 & 110 degrees.

Nice, :smiley:
thanks for your reply @bill
I will check it.

Hello @bill,

I got the way to do this, but it is not working for me. I am wondering if maybe due to device scale, it is in ° Celsius and 0.1 scale, maybe the regular expressions / regex does not recognize it and do not work.

Do you have any another suggestion?

Thanks

I forgot about decimal points. Uncheck that “Match Whole Line” option in the range generator. That should fix your issue.
http://gamon.webfactional.com/regexnumericrangegenerator/

Here’s a great little online tool I frequently use to quickly validate my regex expressions.
https://rubular.com/

Thank you @bill, it has work perfectly now. I can change the color like I wanted, and know I can see a lot of possibilities.