下面是ListBoxItem的一个Simple Style,ListBoxItem有一个子Border。Border 有一个值为 8 的 Padding 属性,我想在选择项目时将值更改为 0。如何编写触发器?
<??Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}" >
<Border
SnapsToDevicePixels="True"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Padding = "8"
Background="{TemplateBinding Background}">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
??<Setter Property="Padding" Value="0" />?? <----How Can I do this?
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<??/Style>