Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Image filling the container and keeping aspect ratio

$
0
0

In case someone needs this as well, I want to share a simple implementation I made.

Unfortunately there’s no way to display the Image filling the container while keeping its aspect ratio without either clipping it or letterbox’ing it.
This is quite a common task so I created an ImageEx class derived from Image which has an extra Uniform value for Aspect property:

Using other Aspect values Fill, AspectFill, AspectFit works like for the Image class.

You can get a gist for ImageEx class from here: https://gist.github.com/nitescua/c907c2951a719ed3ac34

I wrote a blog post with more info here http://enginecore.blogspot.ro/2015/04/xamarin-forms-image-filling-container.html


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>