wpf 自定义按钮模板

发布时间 2023-11-20 20:47:31作者: 优学者

<Button Width="300" Height="100" Content="自定义按钮" Background="Bisque" FontSize="23" Foreground="Orchid">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">//代表指向的button按钮
<Border Background="{TemplateBinding Background}" BorderBrush="Black" BorderThickness="4" CornerRadius="10">
<ContentPresenter HorizontalAlignment="Center" Content="14321412535" VerticalAlignment="Center"></ContentPresenter>
</Border>

</ControlTemplate>
</Button.Template>
</Button>