ContentPage 的内容未填满整个页面 - 毛伊岛

问题描述 投票:0回答:1

在我的应用程序(适用于 iOS,使用 iPhone 14 Plus 进行测试)中,我有一个页面想要显示为模式。目前的问题是,当我将其显示为模式时,内容不会填充整个页面。这在屏幕顶部不是问题。然而,底部也有空间,我不知何故无法填充内容。我在这里做错了什么吗?

在页面的xaml中我只定义了背景和边框元素。正如这里所见:

    <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 Background="Red">

    <Border Background="{StaticResource DefaultBackgroundColor}" StrokeThickness="0"/>
    
   </Contentpage>
xaml layout modal-dialog maui
1个回答
0
投票

Border
的行为只有在有子元素时才定义。要填写父项,请尝试:

<Border Background="{StaticResource DefaultBackgroundColor}" StrokeThickness="0">
  <Grid RowDefinitions="*">
  </Grid>
</Border>

带有“*”行的网格占用所有可用空间。

© www.soinside.com 2019 - 2024. All rights reserved.