我一直在阅读 Programming WPF,这是关于 Control Template 的示例之一:
<Button DockPanel.Dock="Bottom" x:Name="addButton" Content="Add">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Ellipse Width="128" Height="32" Fill="Yellow" Stroke="Black" />
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" />
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
我想知道为什么使用网格而不是更简单的面板,例如画布?由于我们没有标记任何行/列?
谢谢!