Xaml Xamarin表单图像不适合UWP应用程序上的窗口
我有一个简单的页面,应该显示一个图像。在我的android应用程序上,它适合手机屏幕,但在我运行在笔记本电脑上的UWP应用程序上,图像从窗口向外展开。我尝试了所有不同的方面的选择和不同的水平和垂直方向的选择没有运气 我的页面如下所示:Xaml Xamarin表单图像不适合UWP应用程序上的窗口,xaml,xamarin,xamarin.forms,uwp,xamarin.uwp,Xaml,Xamarin,Xamarin.forms,Uwp,Xamarin.uwp,我有一个简单的页面,应该显示一个图像。在我的android应用程序上,它适合手机屏幕,但在我运行在笔记本电脑上的UWP应用程序上,图像从窗口向外展开。我尝试了所有不同的方面的选择和不同的水平和垂直方向的选择没有运气 我的页面如下所示: <ContentPage.Content> <StackLayout > <StackLayout VerticalOptions="Center" > <Image Asp
<ContentPage.Content>
<StackLayout >
<StackLayout VerticalOptions="Center" >
<Image Aspect="AspectFit" Source="{Binding ImageSource, Converter={StaticResource LocalByteToImageFieldConverter}}" />
</StackLayout>
</StackLayout>
</ContentPage.Content>
输出如下所示:
<ContentPage.Content>
<StackLayout >
<StackLayout VerticalOptions="Center" >
<Image Aspect="AspectFit" Source="{Binding ImageSource, Converter={StaticResource LocalByteToImageFieldConverter}}" />
</StackLayout>
</StackLayout>
</ContentPage.Content>
安卓:
UWP:
我猜我缺少一些小东西,但找不到正确的样式设置。尝试使用Image Source=“aa.jpg”Aspect=“AspectFill”尝试使用Image Source=“aa.jpg”Aspect=“AspectFill”试试这个,可能会对你有所帮助
<Grid VerticalOptions="Fill" HorizontalOption="Fill" >
<Image Aspect="AspectFit" Source="{Binding ImageSource,
Converter={StaticResource LocalByteToImageFieldConverter}}" />
</Grid>
试试这个,可能对你有帮助
<Grid VerticalOptions="Fill" HorizontalOption="Fill" >
<Image Aspect="AspectFit" Source="{Binding ImageSource,
Converter={StaticResource LocalByteToImageFieldConverter}}" />
</Grid>
尝试设置高度和宽度?@Luke您也可以将图像放入网格,然后设置RowDefinition height=“Auto”
尝试设置高度和宽度?@Luke您也可以将图像放入网格,然后设置RowDefinition height=“Auto”