Hello,
Welcome to our Microsoft Q&A platform!
You can try to set propeties HorizontalOptions
and VerticalOptions
of this button to FillAndExpand
.
And set the parent's Padding
to 0
.
You can refer to the following code:
<StackLayout BackgroundColor="Yellow" WidthRequest="300" HeightRequest="50" HorizontalOptions="Center" VerticalOptions="Center" Padding="5">
<Button Text="Example" BackgroundColor="Pink" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand"/>
</StackLayout>
Note: As a test, I assign the WidthRequest
and HeightRequest
to an actual number, and if we want the inner button to auto-fit the container , we can just set using the following code:
HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand"
Best Regards,
Jessie Zhang
---
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.