我有一个弹出窗口,但在视觉设计器中它既不拉伸也不居中。为什么是这样?我怎样才能达到这个效果?
这就是我在可视化树中设置它的方式:
<Popup x:Name="namePromptPopup" IsLightDismissEnabled="True" Grid.Row="1" Grid.Column="1">
<Popup.ChildTransitions>
<TransitionCollection>
<PopupThemeTransition/>
</TransitionCollection>
</Popup.ChildTransitions>
<StackPanel>
<Border BorderBrush="White" BorderThickness="5" >
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF600F0F"/>
<GradientStop Color="#FFB81C1C" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBox Text="Generic Name" FontSize="38" HorizontalAlignment="Center" Width="320" />
<Button Content="Submit" Click="namePromptSubmit" HorizontalAlignment="Center" />
</StackPanel>
</Border>
</StackPanel>
</Popup>
似乎弹出控件根本不响应布局。