I need help with image size. I'm trying to fill the width of my stacklayout and keep the ratio with the height.
But all my images gets distorted if I use Aspect.Fill, and if I use Aspect.Fit it crops my image...
You're on the right track and the AspectFit is what you're looking for, but the problem is you need to make a decision. ...do you want it based on Width or Height? You can't have it both ways (as far as I am aware) because that would be an AspectFill (both width and height have priority), right?
For the "missing" area set the background color on the StackLayout.
So set the Aspect="AspectFit" and set your priority as HorizontalOptions="FillAndExpand" (or Vertical).
What you can also do is check the size of the image and bind the Vertical/Horizontal states based on the X/Y, if you need it to be dynamic.
Let me know if that works for you!
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies