16 September 2015

Using system accent color brush from code in Windows 10 UWP

A very short one this time. I wanted to give some UI element the same color as the accent color, but I wanted to use it from code, not from XAML, as written for instance here.

Turns out it's called "SystemControlHighlightAccentBrush" and you can use it like this:

Brush _blinkBrush = 
  Application.Current.Resources["SystemControlHighlightAccentBrush"] 
    as SolidColorBrush;

And of course, once you know it's called "SystemControlHighlightAccentBrush" you can find it everywhere, like on Stack Overflow. So I am writing this down as much as a personal reminder as for you ;)

I used in my latest IoT demo solution that you can find here. It's in project TemperatureReader.ClientApp, class Behaviors.BlinkBehavior.

No comments: