2
votes

Using xamarin forms to develop a cross platform app, initially the app was built using Xamarin.Forms.2.4.0.38779, target framework was 6.0 and Android support library version 23.3.0. The UI code is:

// styles
<Style x:Key="DefaultButtonStyle" TargetType="Button">
    <Setter Property="TextColor" Value="DodgerBlue"></Setter>
    <Setter Property="BackgroundColor" Value="Transparent"></Setter>
</Style>
<Style x:Key="RoundBorderButtonStyle" TargetType="Button" BasedOn="{StaticResource DefaultButtonStyle}">
    <Setter Property="BorderWidth" Value="1"></Setter>
    <Setter Property="BorderRadius" Value="30"></Setter>
    <Setter Property="BorderColor" Value="DodgerBlue"></Setter>
</Style>

<StackLayout Margin="15,0" Spacing="20" Orientation="Horizontal">
    <Button Style="{StaticResource RoundBorderButtonStyle}" HorizontalOptions="FillAndExpand" Text="Copy"></Button>
    <Button Style="{StaticResource RoundBorderButtonStyle}" HorizontalOptions="FillAndExpand" Text="Addresses"></Button>
</StackLayout>

Then the vs2017 got updated, so does xamarin forms, so I also updated the project to use latest libraries, with Xamarin.Forms.2.4.0.38779 and android target framework version 8.0, support libraries 26.1.0.1. Then suddenly the button is not rendered correctly. Before update: enter image description here

after update:

enter image description here

Is there anything else I need to do to update xamarin forms?

Update

I created a minimum test case to show the problem, in vs create a cross-platform project, the only file changed is TestButton/TestButton/MainPage.xaml. The app screenshot:

enter image description here

1
Could you please post the codes of RoundBorderButtonStyle?Elvis Xia - MSFT
@ElvisXia-MSFT it's in the post, above the button xamlfluter
sorry, missed that, I'll have a try by my side.Elvis Xia - MSFT
Just tried with support lib 26 and target framework 8.0, but failed to reproduce the problem. Could you please try it on other device/emulator?Elvis Xia - MSFT
@ElvisXia-MSFT I tried with tablet emulator, still the same issue.fluter

1 Answers

2
votes

so I also updated the project to use latest libraries, with Xamarin.Forms.2.4.0.38779 and android target framework version 8.0, support libraries 26.1.0.1. Then suddenly the button is not rendered correctly

I reproduced the problem with your project,and I found it was caused by the Xamarin.Forms library. I noticed in your sample project the version of Xamarin.Forms is latest(2.4.0.74863).

Solution: By downgrading Xamarin.Forms to 2.4.280 and do a clean rebuild and reinstall of the app will fix the problem.