XAML 在.Net MAUI Ammon Fit中删除图像周围的白色空间

au9on6nz  于 12个月前  发布在  .NET
关注(0)|答案(1)|浏览(102)

我在.Net MAUI中有一个简单的VerticalLayout。我试图在两个标签之间放置一个图像。但是,图像前后添加了大量的白色空间。


的数据

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:MyApp.Helpers" x:Class="MyApp.Views.OrgDash.VolunteerPage" Title="MyTitle">
    <ContentPage.Content>
        <Grid Margin="0" Padding="0" RowDefinitions="*,Auto">
            <ScrollView Grid.Row="0" Padding="10,10,10,0">
                <VerticalStackLayout x:Name="verticalLayout">
                    <Label x:Name="nameLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" FontAttributes="Bold" />
                    <Label x:Name="emailLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center">
                        <Label.FormattedText>
                            <FormattedString>
                                <local:HyperlinkSpan x:Name="emailSpan" />
                            </FormattedString>
                        </Label.FormattedText>
                    </Label>
                    <Label x:Name="ageLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" />
                    <Label x:Name="drivingLicenseLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" />
                    <Label x:Name="commentsLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" />
                    <Image x:Name="avatarImage" Aspect="AspectFit"/>
                    <Label x:Name="contactInformationLabel" Text="Contact Information" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" FontAttributes="Bold" />
                    <Label x:Name="phoneLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center">
                        <Label.FormattedText>
                            <FormattedString>
                                <local:HyperlinkSpan x:Name="phoneSpan" />
                            </FormattedString>
                        </Label.FormattedText>
                    </Label>
                    <Label x:Name="addressLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" />
                    <Label x:Name="emergencyInformationLabel" Text="Emergency Contact Information" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" FontAttributes="Bold" />
                    <Label x:Name="emergencyNameLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" />
                    <Label x:Name="emergencyRelationshipLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" />
                    <Label x:Name="emergencyEmailLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center">
                        <Label.FormattedText>
                            <FormattedString>
                                <local:HyperlinkSpan x:Name="emergencyEmailSpan" />
                            </FormattedString>
                        </Label.FormattedText>
                    </Label>
                    <Label x:Name="emergencyPhoneLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center">
                        <Label.FormattedText>
                            <FormattedString>
                                <local:HyperlinkSpan x:Name="emergencyPhoneSpan" />
                            </FormattedString>
                        </Label.FormattedText>
                    </Label>
                    <Label x:Name="UseaNumberHeaderLabel" Text="USEA Number" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" FontAttributes="Bold" />
                    <Label x:Name="UseaNumberLabel" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" />
                </VerticalStackLayout>
            </ScrollView>
            <VerticalStackLayout Grid.Row="1" Padding="10,15,10,15">
                <Button x:Name="emailButton" Text="Email" Clicked="OnEmailClicked" CornerRadius="5" BackgroundColor="{StaticResource PrimaryColor}" TextColor="White" FontAttributes="Bold" />
            </VerticalStackLayout>
        </Grid>
    </ContentPage.Content>
</ContentPage>

字符串

相关问题