我有以下窗口定义
<Window x:Class="MyWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Style="{StaticResource ShapedWindow}"
Title="Title">
<Grid Name="grid1" />
</Window>
具有以下样式和模板定义
<Style x:Key="ShapedWindow" TargetType="{x:Type Window}">
<Setter Property="AllowsTransparency" Value="True"></Setter>
<Setter Property="WindowStyle" Value="None"></Setter>
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="MinWidth" Value="300" />
<Setter Property="MinHeight" Value="300" />
<Setter Property="Template" Value="{StaticResource ShapedWindowTemplate}"></Setter>
</Style>
<ControlTemplate x:Key="ShapedWindowTemplate" TargetType="{x:Type Window}">
<!--<AdornerDecorator>
<ContentPresenter />
</AdornerDecorator>-->
</ControlTemplate>
在设计器中产生以下窗口
当我从模板定义中删除注释时,网格似乎没有呈现在同一位置?我在这里想念什么?