Click here to Skip to main content
13,344,765 members (51,482 online)
Click here to Skip to main content
Add your own
alternative version


2 bookmarked
Posted 31 Oct 2011

WPF ListView look-and-feel for WPF ListBox items

, 31 Oct 2011
Rate this:
Please Sign up or sign in to vote.
How to get WPF ListBox items with the same look-and-feel as items in a WPF ListView.

Add the following XAML snippet to your XAML resource section and you will get WPF ListBox items with the same look-and-feel as the items in a WPF ListView. Much nicer I think than the ListBox default.

Plain and Boring

Gradient and Nice Looking

<lineargradientbrush x:key="{x:Static SystemColors.HighlightBrushKey}" 

           endpoint="0,1" startpoint="0,0" xmlns:x="#unknown">
  <gradientstop color="#FFD9F4FF" offset="0" />
  <gradientstop color="#FF9BDDFB" offset="1" />
<lineargradientbrush x:key="{x:Static SystemColors.ControlBrushKey}" 

           endpoint="0,1" startpoint="0,0" xmlns:x="#unknown">
  <gradientstop color="#FFEEEDED" offset="0" />
  <gradientstop color="#FFDDDDDD" offset="1" />
<solidcolorbrush x:key="{x:Static SystemColors.HighlightTextBrushKey}" color="Black" xmlns:x="#unknown" />
<solidcolorbrush x:key="{x:Static SystemColors.ControlTextBrushKey}" color="Black" xmlns:x="#unknown" />

<Style TargetType="{x:Type ListBoxItem}">
  <setter property="BorderThickness" value="1.5" />
    <trigger property="IsSelected" value="True">
      <setter property="BorderBrush" value="#adc6e5" />
    <Style TargetType="Border">
      <setter property="CornerRadius" value="2" />


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Måns Tånneryd
Software Developer (Senior) Tånneryd IT AB
Sweden Sweden
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralReason for my vote of 5 Good One. Pin
ring_01-Nov-11 3:06
memberring_01-Nov-11 3:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180111.1 | Last Updated 31 Oct 2011
Article Copyright 2011 by Måns Tånneryd
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid