MainPage = new TabbedPage {
Children = {
new ContentPage {
Title = "AspectFill",
Content = new Image {
Source = ImageSource.FromResource("xamarin"),
Aspect = Aspect.AspectFill,
},
},
new ContentPage {
Title = "AspectFit",
Content = new Image {
Source = ImageSource.FromResource("xamarin"),
Aspect = Aspect.AspectFit,
},
},
new ContentPage {
Title = "Fill",
Content = new Image {
Source = ImageSource.FromResource("xamarin"),
Aspect = Aspect.Fill,
},
},
},
};
The three Aspect values and their respective meaning are:
- AspectFill to preserve the aspect ratio and to scale the image to fill the available space completely, possibly cropping parts of the image,
- AspectFit to preserve the aspect ratio and to scale the image to fill at least one dimension of the available space, possibly leaving some blank space next to the image, and
- Fill to fill the available space without preserving the aspect ratio.