我尝试在xaml中为按钮创建白色边框,但边框未显示
XAML语言
<Window x:Class="useless trash here that nobody cares">
<Window.Resources>
<Style TargetType="Button">
<Setter Property="Width" Value="200"/>
<Setter Property="Background" Value="#FF151515"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Height" Value="50"/>
<Setter Property="FontFamily" Value="Arial"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Width" Value="500"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FF2E2E2E"/>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
<Button Content="Button" BorderBrush="#FFDC3B3B"/>
</ScrollViewer>
<TextBox x:Name="LaunchP" FontFamily="Cascadia Mono SemiBold" VerticalAlignment="Bottom" TextChanged="updateLaunchParams" Height="18" Width="500" />
</Grid>
</Window>
按钮属性也不适用于设置BorderBrush或BorderThickness
1条答案
按热度按时间b1uwtaje1#
我通过将属性添加到
<template>
标记中修复了该问题