摆脱 ListView 中 1 像素的填充/边框间隙?
看看这个!
我真的需要摆脱这个!
看说明!
<ListView Name="list" BorderThickness="0">
我该如何修复它?
这种间隙不仅发生在滚动条上,也发生在有或没有任何视图的项目上。
Look at this!
I really need to get rid of this!
Look at the delcaration!
<ListView Name="list" BorderThickness="0">
How do I fix it?
This gap doesn't only happen to the scrollbar, it also happens to the items, with or WITHOUT any views.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你有 Blend,这个问题会更容易修复。如果没有,可以免费试用。您必须为您在该列表中使用的滚动查看器生成控件模板的副本。从那里您可以编辑滚动条的模板。
一旦您接触到滚动条模板,它就会有几个级别的模板深度。 ListView 模板>ItemsPresenter(在本例中为包裹面板)模板> ScrollViewer 模板 >滚动条模板。
This would be easier to fix in Blend if you have it. if not there is a free trial. You will have to generate a copy of the control template for the scrollviewer that you are using in that list. From there you can edit the template for the ScrollBar.
The scroll bars template is going to be several levels of templates deep once you get to it. ListView Template>ItemsPresenter (In this case a Wrap Panel) Template> ScrollViewer Template > ScrollBar Template.
看起来像是
Template
中的问题,很可能是内部控件的属性,该属性未绑定到 ListBox 向您公开的任何属性。Vercas 编辑:我发现了问题。
这是
ListView
的模板:只需将Border的
Padding
更改为0即可。如果您不想费心寻找房产,这就是结果。
不要忘记将此模板添加到您的
ListView
中!Looks like a problem in the
Template
, most likely a property of an internal control which is not bound to any of the properties the ListBox exposes to you.Edit by Vercas: I have found the problem.
This is the template of the
ListView
:Just change the
Padding
of the Border to 0 and you're done.Here is the result if you don't want to bother finding the property.
Don't forget to add this template to your
ListView
!