How to set WidthRequest = 50 to a button in Xamarin.Forms for Windows Phone?

WidthRequest = 50 on Windows Phone does not work. On Android and iOS, it works. But in WinPhone, only half the button is displayed. I also tried using MinWidthRequest, which also does not work.

The button accepts a MinimumWidth of just 109 in a Windows phone. Less than 109 WIdthRequest, overflowing width disappears. Does anyone know how to change this MinWidthRequest in WinPhone? or any other solution for this?

<StackLayout VerticalOptions="Center" HorizontalOptions="Center">
    <Label Text="WidthRequest=109" HorizontalTextAlignment="Center" Margin="0,10,0,0"/>
    <Button HorizontalOptions="Center" VerticalOptions="Center" Text="109" HeightRequest="50" WidthRequest="109"/>
    <Label Text="WidthRequest=108"  HorizontalTextAlignment="Center" Margin="0,10,0,0"/>
    <Button HorizontalOptions="Center" VerticalOptions="Center" Text="108" HeightRequest="50" WidthRequest="108"/>
    <Label Text="WidthRequest=70"  HorizontalTextAlignment="Center" Margin="0,10,0,0"/>
    <Button HorizontalOptions="Center" VerticalOptions="Center" Text="70" HeightRequest="50" WidthRequest="70"/>
    <Label Text="WidthRequest=50" HorizontalTextAlignment="Center" Margin="0,10,0,0"/>
    <Button HorizontalOptions="Center" VerticalOptions="Center" Text="50" HeightRequest="50" WidthRequest="50"/>
</StackLayout>

So the button is displayed in Windows Phone

This is how the button appears in Android

+4
source share
1 answer

, , CustomRender Control.MinWidth . MinimumWidthRequest , , Xamarin.Forms.

+4

Source: https://habr.com/ru/post/1673264/


All Articles