Forum Xamarin.Forms

Image control, a new Aspect value to use size of the image

AndrewMobileAndrewMobile USMember ✭✭✭✭
edited June 2017 in Xamarin.Forms


The Aspect property of the Image control (surprisingly) does not have a value to make the Image control use the size of its image given by Source property.
If you look to WPF, there's Stretch.None

I can't see a way currently to do this in Xamarin Forms. The only workaround I can see is to set WidthRequest and HeightRequest on the Image contrrol, but it's not nice, and it only works if you know the image size.

API Changes

My suggestion is to have a new Aspect enumeration value, called None.

The way it should work in code and XAML is pretty straightforward:


Image image = new Image() 
     Aspect = None              


<Image Source="myImage" 
              Aspect="None" />

Intended Use Case

Preserve image original size.


Open · Last Updated


  • VelocityVelocity NZMember ✭✭✭
    edited June 2017

    You can of course create an extended image with an Aspect property and then support it in each custom renderer, however I do agree this would be a useful addition to the stock XF Image control.

  • AndrewMobileAndrewMobile USMember ✭✭✭✭

    @Velocity Thanks. I am not looking into workarounds. There's so many workarounds/libraries to different things just because it's not in the framework.

Sign In or Register to comment.