Reputation: 10503
Button Images inside Xamarin.Forms are appearing squeezed on iOS. How do you set the Image to display in normal aspect ratio in XAML? Also as a bonus how do you make sure the Button Images line up vertically? I have tried setting the WidthRequest XAML property but it has no effect.
XAML in ContentPage.Content:
<StackLayout Orientation="Vertical" VerticalOptions="Start" HorizontalOptions="Fill" Padding="20">
<Button Image="icon_facebook" Clicked="onClicked" Text="Facebook" />
<Button Image="icon_twitter" Clicked="onClicked" Text="Twitter" />
<Button Image="icon_microsoft" Clicked="onClicked" Text="Microsoft Account" />
<Button Image="icon_google" Clicked="onClicked" Text="Google" />
</StackLayout>
Upvotes: 2
Views: 1636
Reputation: 33993
If you are open to it you could use the ImageButton
from the XLabs package.
Alternatively you could go for a ListView
with ImageCell
s or if that doesn't give you enough flexibility create your own ViewCell
. These align well by default and you can trigger the proper action when a user taps an item in the list.
Here is an example of Apple themselves doing something similar:
Upvotes: 1