我有一个包含ListBoxItems的ListBox,我已经将Button作为ListBoxItems以Vertical形式添加。 按钮之间的空格由边距设置。 但当我点击按钮下方时,它正在调用该事件。
我应该如何移除它?我如何设置ListBoxItem&的高度?该项目的保证金?
答案 0 :(得分:0)
您可以使用ListBox.ItemContainerStyle
获取或设置渲染项容器时使用的样式(ListBoxItems
),此边距将为您执行所需的任务:尝试以下代码:
<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>