这里是我目前使用的法典:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ButtonPrototype.MainPage"
Width="640" Height="480">
<UserControl.Resources>
<ControlTemplate x:Key="CellTemplate" TargetType="Button">
<Grid>
<Border x:Name="CellBorderBrush" BorderBrush="Black" BorderThickness="1">
<ContentPresenter
Content="{TemplateBinding Content}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
</Grid>
</ControlTemplate>
<Style x:Key="CellStyle" TargetType="Button">
<Setter Property="Template" Value="{StaticResource CellTemplate}"></Setter>
<Setter Property="Foreground" Value="Black"></Setter>
<Setter Property="FontSize" Value="80"></Setter>
<Setter Property="Width" Value="100"></Setter>
<Setter Property="Height" Value="100"></Setter>
</Style>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<Button Content="A" Style="{StaticResource CellStyle}"></Button>
</Grid>
</UserControl>
横向调整工程,但纵向调整没有任何意义。 感谢您的帮助。