【发布时间】:2010-12-10 10:38:40
【问题描述】:
如何将 ListBoxItems 上的默认边框设为虚线边框?请参阅以下样式:
<Grid.Resources>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Height" Value="30" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
<Setter Property="BorderBrush" Value="Silver" />
<Setter Property="Content" Value="" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="3">
<Setter Property="BorderBrush" Value="Black"></Setter>
</Trigger>
</Style.Triggers>
</Style>
</Grid.Resources>
在这里,我将 AlternationIndex 0、1 和 2 设为虚线边框,而不是实线。如何做到这一点?
【问题讨论】:
-
另外,请在此处查看我的答案:stackoverflow.com/a/17431518/1230982 我们能够使用这种技术来使用实际的边框并避免使用矩形。