Andrej Tozon's blog

In the Attic

NAVIGATION - SEARCH

Countdown to Silverlight 3 #6: System colors

With Silverlight 3, we now have access to system colors. If you need your new application to visually fit into the operating system it’s running on, simply inspect one of the static properties, provided by the new SystemColors class – System.HighlightColor for example, will tell you what color is used for highlighting the selection in ListBoxes.

The provided example (below) will enumerate all available system colors and display them on the screen. To test it, go to your Control Panel and change the color scheme, then restart the application.

image image
Windows Aero vs. High Contrast Black

Additional reading
http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2009/04/29/
silverlight-3-system-colours.aspx

Run the sample online

Source code below: