I'm trying to create a white border for the buttons in xaml but the border doesn't show
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>
The button properties also doesn't work for setting the BorderBrush or the BorderThickness
CodePudding user response:
I fixed it by adding the properties to the <template>
tag