How to not let ImageButton get stretched sideways.

chunggchungg Member ✭✭
edited February 13 in Xamarin.Forms

On the iPhone 11:
On iPad Pro:

I have these search bars and image buttons using Xamarin Forms, but the image button is getting stretched out, and I don't know how I can fix it with the XAML set up that I have.

` <Grid>
        <RowDefinition Height="40" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />

  <SearchBar Grid.Row="0" Grid.Column="0"
             Text="{Binding SearchText}"
  <ImageButton Grid.Row="0" Grid.Column="1" 
               Command="{Binding Filter}" Source="filter.png" BackgroundColor="Transparent">`

The problem is, that if I set the image button to a specific width, to make it universal among devices, I don't know how to tell XAML to just stretch the search bar up to the image. What can I do?

The Android phones and tablets both look like it's supposed to.

Best Answer


  • chunggchungg Member ✭✭
    edited February 13

    This is actually what the picture looks like on the tablet, it's squished, not stretched. I had the stretching problem earlier.

    edit: I'm not sure why there's just a blank space between the search bar and the image, if the image just took up that space like it should, there'd be no problem.

  • MogspogsMogspogs Member ✭✭

    This seems to be an issue on IOS: Bug Report

    Downgrading Xamarin version to or earlier fixes the issue but obviously not an ideal solition

  • chunggchungg Member ✭✭

    @ColeX That worked thanks! I did have to add a few margins to make it look better but it did stop stretching and squishing so much.

Sign In or Register to comment.