调整一侧的边框 [英] adjust border on one specific side

查看:109
本文介绍了调整一侧的边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ListBox的controlTemplate来显示集合. 我想显示所有带有边框的项目,例如在网格中(所有行的大小均相同). 当我为每个listBoxItem赋予边框时,两个项目之间的线的尺寸是原来的两倍. (由第一项的底部边框和第二项的顶部边框制成)

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)

所以问题是: 我可以在项目的单面设置/隐藏边框吗? (如CSS中的"border-top")

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

推荐答案

border属性是厚度,就像边距和填充一样,因此您可以执行Border ="2,0,2,2"来获得边框除了顶部,其他所有地方都2.

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.

这篇关于调整一侧的边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆