adjust border on one specific side

Jowen picture Jowen · Jan 31, 2009 · Viewed 12.1k times · Source

I'm using a controlTemplate of the ListBox to show a collection. I want to display all the items with a border like in a grid (all lines same size). When I give every listBoxItem a border, the line between 2 items has a double size. (made from the bottom border of the first item, and the top border of the second item)

So the question is: Can I set/hide the border on a single side of an item? (like 'border-top' in css)

Answer

Bryan Anderson picture Bryan Anderson · Jan 31, 2009

The border property is a thickness, just like margin and padding, so you can do Border="2,0,2,2" to get a border of 2 everywhere except the top.