【发布时间】:2012-04-09 03:02:50
【问题描述】:
我正在设计一个列表框。我正在尝试清除边距,所以我意识到了它,我将样式的填充设置为 0(左填充)。
但我仍然可以在其中看到一些边距,我需要在其中没有边距吗?你知道哪个会是问题吗?
<ListBox ItemsSource="{Binding Partitions}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="0"/>
<Setter Property="Canvas.Top">
...
</Setter>
</Style>
</ListBox.ItemContainerStyle>
我的意思是,我可以看到项目周围有一个额外的空间,我无法处理它来修改为 0。
【问题讨论】:
-
你的完整代码是什么?我将它插入到一个基本的网格中并没有遇到这个问题
-
可能duplicate。请参阅问题中的第二个答案。
标签: c# wpf xaml listbox styles