我有一个包含ListBoxItems的ListBox,我添加了按钮作为垂直形式的ListBoxItems。按钮之间的间距由边距设置。但当我点击按钮下方时,它正在调用该事件。
我该如何删除它?以及如何设置ListBoxItem&该项目的保证金?
您可以使用ListBox.ItemContainerStyle
来获取或设置在呈现项目容器(ListBoxItems
)时使用的样式。在这里,Margin将为您完成所需的任务:尝试以下代码:
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Margin" Value="5"/>
<Setter Property="Height" Value="75"/> <!-- For setting height of control-->
<Setter Property="Width" Value="75"/> <!-- For setting widthof control-->
</Style>
</ListBox.ItemContainerStyle>