Xamarin Forms图像不适合UWP应用程序上的窗口

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

我有一个应该显示图像的简单页面。在我的android应用中,它适合手机屏幕,但是在笔记本电脑上运行的UWP应用中,图像扩展到了窗口之外。我尝试了所有不同的纵横比选项以及不同的水平和垂直方向选项,但是没有运气。

我的页面看起来像这样:

<ContentPage.Content>
    <StackLayout >
        <StackLayout VerticalOptions="Center" >
            <Image Aspect="AspectFit" Source="{Binding ImageSource, Converter={StaticResource LocalByteToImageFieldConverter}}" />
        </StackLayout>
    </StackLayout>
</ContentPage.Content>

输出看起来像这样:

Android:

Android

UWP:

UWP

我猜测它缺少一些小东西,但找不到正确的样式设置。

xaml xamarin xamarin.forms uwp xamarin.uwp
2个回答
0
投票

尝试使用Image Source =“ aa.jpg” Aspect =“ AspectFill”


0
投票

尝试一下,可能对您有帮助

<Grid VerticalOptions="Fill" HorizontalOption="Fill" >
    <Image Aspect="AspectFit" Source="{Binding ImageSource, 
           Converter={StaticResource LocalByteToImageFieldConverter}}" />
</Grid>
© www.soinside.com 2019 - 2024. All rights reserved.