[英]UWP | Popup width and height
I created a simple popup like below我创建了一个简单的弹出窗口,如下所示
<Grid>
<Popup VerticalOffset="0" HorizontalOffset="0" x:Name="StandardPopup" >
<Border BorderBrush="Red"
Background="Red"
BorderThickness="0">
<StackPanel>
<TextBlock Text="Simple Popup" FontSize="10.667"/>
<Button Content="Close" Click="ClosePopupClicked"/>
</StackPanel>
</Border>
</Popup>
</Grid>
However, when I query it's size, is coming as (w, h) = (220, 480).但是,当我查询它的大小时,它是 (w, h) = (220, 480)。 This looks like an incorrect size, as it is rendered very small.
这看起来像一个不正确的大小,因为它被渲染得非常小。 I have read about placement of popup etc, but cannot understand how to find the true correctly rendered size of a popup.
我已经阅读了关于弹出窗口等的放置,但不明白如何找到弹出窗口的真实正确渲染大小。
You should set the content's width and height of Popup
, eg,您应该设置
Popup
的内容的宽度和高度,例如,
<Border Width="360" Height="200">
</Border>
Otherwise, the size of Popup
will auto fit its content.否则,
Popup
的大小将自动适应其内容。
See more doc: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.primitives.popup?view=winrt-18362查看更多文档: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.primitives.popup?view=winrt-18362
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.