Description
No matter what you set on HorizontalOptions and VerticalOptions, it is ignored when the ImageSource property is set on a Button. It works fine if the ImageSource property is not set.
NB! Version with bug is: 8.0.0-rc.2.9511 NOT 8.0.0-rc.2.9373. I could not find 8.0.0-rc.2.9511 in the list below.
Steps to Reproduce
Add a Button like so: <Button Text="This is a test" HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Green" /> wrapped inside for example a Grid. Observe that the Button only uses the space that it needs to display the text.
Now add an ImageSource to the Button like so: <Button Text="This is a test" HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Green" ImageSource="icon.png" />. Observe that the Button will use the whole space. It behaves exactly as if the VerticalOptions and HorizontalOptions are set to Fill
Link to public reproduction project repository
No response
Version with bug
8.0.0-rc.2.9373
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.0-rc.2.9373
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
You can set 'HeightRequest' and 'WidthRequest' to force the 'Button' to only use that much space. However, not feasible to use.
Relevant log output
No response
Description
No matter what you set on HorizontalOptions and VerticalOptions, it is ignored when the ImageSource property is set on a Button. It works fine if the ImageSource property is not set.
NB! Version with bug is: 8.0.0-rc.2.9511 NOT 8.0.0-rc.2.9373. I could not find 8.0.0-rc.2.9511 in the list below.
Steps to Reproduce
Add a
Buttonlike so:<Button Text="This is a test" HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Green" />wrapped inside for example aGrid. Observe that theButtononly uses the space that it needs to display the text.Now add an ImageSource to the
Buttonlike so:<Button Text="This is a test" HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Green" ImageSource="icon.png" />. Observe that theButtonwill use the whole space. It behaves exactly as if theVerticalOptionsandHorizontalOptionsare set toFillLink to public reproduction project repository
No response
Version with bug
8.0.0-rc.2.9373
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.0-rc.2.9373
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
You can set 'HeightRequest' and 'WidthRequest' to force the 'Button' to only use that much space. However, not feasible to use.
Relevant log output
No response