Luke Konecki
Luke Konecki

Reputation: 127

Xamarin Forms Image not fitting to window on UWP app

I have a simple page that is supposed to display an image. On my android app it fits to the phone screen, but on my UWP app running on a laptop the image expands out of the window. I have tried all different aspect options and different Horizontal and Vertical Orientation options with no luck.

My page looks like this:

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

And the output looks like this:

Android:

Android

UWP:

UWP

I'm guessing its something small I'm missing but cannot find the right style settings.

Upvotes: 0

Views: 105

Answers (2)

Sandeep Singh
Sandeep Singh

Reputation: 66

try this , may be helpful for you

<Grid VerticalOptions="Fill" HorizontalOption="Fill" >
    <Image Aspect="AspectFit" Source="{Binding ImageSource, 
           Converter={StaticResource LocalByteToImageFieldConverter}}" />
</Grid>

Upvotes: 3

Je Ma Jr
Je Ma Jr

Reputation: 1

try use Image Source="aa.jpg" Aspect="AspectFill"

Upvotes: 0

Related Questions