简体   繁体   中英

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). 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,

<Border Width="360" Height="200">

</Border>

Otherwise, the size of Popup will auto fit its content.

See more doc: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.primitives.popup?view=winrt-18362

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM