我不熟悉所有的 CSS 属性,但你可以覆盖它ControlTemplate
是这样的:
<Style TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderThickness="1,0,0,0" Width="165">
<Border.BorderBrush>
<SolidColorBrush Color="#363636"/>
</Border.BorderBrush>
<Border BorderThickness="0,1,0,0">
<Border.BorderBrush>
<SolidColorBrush Color="#363636"/>
</Border.BorderBrush>
<Border BorderThickness="0,0,1,0">
<Border.BorderBrush>
<SolidColorBrush Color="#121212"/>
</Border.BorderBrush>
<Border BorderThickness="0,0,0,1">
<Border.BorderBrush>
<SolidColorBrush Color="#121212"/>
</Border.BorderBrush>
<TextBlock Text="{TemplateBinding Content}"
FontSize="13"
Width="165"
Padding="25,0,0,0">
<TextBlock.Foreground>
<SolidColorBrush Color="#ebebeb"/>
</TextBlock.Foreground>
<TextBlock.Background>
<SolidColorBrush Color="#282828"/>
</TextBlock.Background>
<TextBlock.Effect>
<DropShadowEffect Color="#121212"/>
</TextBlock.Effect>
</TextBlock>
</Border>
</Border>
</Border>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
然而,这有点像黑客,但我认为这就是你要找的。但是,如果您想正确执行此操作,则应该考虑创建自己的装饰器。
希望这可以帮助