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

Button images stretched when in horizontal stack layout

$
0
0

In the following Xamarin form, there three cases where buttons (with images) are presented:
a) Buttons are arranged one below the other in a vertical oriented layout => OK (i.e. no stretch on images)
b) Buttons without text, arranged in an horizontally oriented StackLayout, => NOT OK (the images are stretched)
c) Buttons with text, arranged in an horizontally oriented StackLayout, => NOT OK (the images are NOT stretched but the text is truncated)

Unless, I am doing something wrong, I believe that there is a potential bug in this behaviour.

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="test.Demo">
    <ContentPage.Content>
        <StackLayout>
            <Button Image="g735phone.png" />
            <Button Image="g770clip.png" />
            <Button Image="g756bell.png" />
            <StackLayout Orientation="Horizontal">
                <Button Image="g735phone.png" />
                <Button Image="g770clip.png" />
                <Button Image="g756bell.png" />
            </StackLayout>

            <StackLayout Orientation="Horizontal">
                <Button Text="He" Image="g735phone.png" />
                <Button Text="Ve" Image="g770clip.png" />
                <Button Text="De" Image="g756bell.png" />
            </StackLayout>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

Viewing all articles
Browse latest Browse all 58056

Trending Articles