如何在 XAML 中定义 ControlTemplate
如何在 XAML 中定义 ControlTemplate
<StackPanel>
<StackPanel.Resources>
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<!--Define the ControlTemplate here.-->
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</StackPanel.Resources>
<Button Style="{StaticResource ButtonStyle}" Content="Button1"/>
</StackPanel>