WPF: Vista Blue Highlight Brush

April 17th, 2009 by Mel Leave a reply »

For the WPF application I’m currently working on for work I decided that I wanted to change the style for all ListBoxItems so that they looked a little more like list items in Vista when highlighted, instead of the boring white text on a black background.

So I found this wonderful guide to setting the style for IsSelected ListBoxItems across the application. You can find it here: http://www.uxpassion.com/2008/09/styling-wpf-listbox-highlight-color/

Then, for a nice light-blue, glossy vista look I used this gradient:

<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
    <LinearGradientBrush.GradientStops>
        <GradientStop Offset="0" Color="#FFE3F4FC"/>
        <GradientStop Offset="0.38" Color="#FFD8EFFC"/>
        <GradientStop Offset="0.38" Color="#FFBEE6FD"/>
        <GradientStop Offset="1" Color="#FFA6D9F4"/>
    </LinearGradientBrush.GradientStops>
</LinearGradientBrush>

It’s not perfect, but it looks pretty good. I also gave it a solid LightBlue border with a corner radius of 5. Here’s what the results looked like:
Vista Blue Highlight

Advertisement

5 comments

  1. Anson says:

    Nice! I just want to say Thank You!

  2. Chester Husk says:

    Thanks for this, Mel.  I was looking at making a similar themed overlay for highlighted items in menus on my app, and I was able to take your tutorial here and adapt is to my needs.  I bound the points to the dominant color in the highlighted item and it looks fantastic.  Again, many thanks!

  3. Ashraf Fawzy says:

    Many thanks for your tutorial and the Modification code.

  4. Mel says:

    You’re welcome Vibor, and thanks again for writing it! :smile:

  5. Hey Mel, thanks for linking to my tutorial. I am really glad that it was useful for you!

Leave a Reply