<ContentControl x:Class="Test.MyControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="200" Height="200" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Rectangle Fill="Blue"/>
<ContentPresenter Grid.Row="1" Content="{TemplateBinding ContentControl.Content}" />
<Rectangle Fill="Yellow" Grid.Row="2"/>
</Grid>
</ContentControl>
<Window x:Class="Test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Test="clr-namespace:Test" Title="MainWindow" Height="350" Width="525">
<Grid>
<Test:MyControl2>
<Button/>
</Test:MyControl2>
</Grid>
</Window>
Button 应该出现在蓝色和黄色矩形之间。
我究竟做错了什么?