C# 按钮在升级xamarin表单后不立即渲染

C# 按钮在升级xamarin表单后不立即渲染,c#,android,xamarin,xamarin.forms,xamarin.android,C#,Android,Xamarin,Xamarin.forms,Xamarin.android,使用xamarin forms开发跨平台应用程序,最初该应用程序使用xamarin.forms.2.4.0.38779构建,目标框架为6.0,Android支持库版本为23.3.0。用户界面代码为: // styles <Style x:Key="DefaultButtonStyle" TargetType="Button"> <Setter Property="TextColor" Value="DodgerBlue"></Setter> &

使用xamarin forms开发跨平台应用程序,最初该应用程序使用xamarin.forms.2.4.0.38779构建,目标框架为6.0,Android支持库版本为23.3.0。用户界面代码为:

// 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>
//样式
然后vs2017得到了更新,xamarin表单也得到了更新,因此我还更新了项目以使用最新的库,其中xamarin.forms.2.4.0.38779和android目标框架版本8.0支持库26.1.0.1。然后,按钮突然无法正确渲染。更新前:

更新后:

我还需要做什么来更新xamarin表单吗

更新

我创建了一个最小值来说明这个问题,在vs create跨平台项目中,唯一更改的文件是TestButton/TestButton/MainPage.xaml。应用程序屏幕截图:

因此,我还更新了项目以使用最新的库,使用Xamarin.Forms.2.4.0.38779和android目标框架版本8.0,支持库26.1.0.1。然后,按钮突然无法正确渲染

我重现了您的项目中的问题,发现它是由
Xamarin.Forms
库引起的。我注意到在您的示例项目中,
Xamarin.Forms
的版本是最新的(2.4.0.74863)


解决方案:通过将Xamarin.Forms降级到
2.4.280
,然后重新构建并重新安装应用程序,可以解决问题。

您可以发布
RoundBorderButtonStyle
的代码吗?@ElvisXia MSFT它在帖子中,在按钮Xaml的上方抱歉,错过了这一点,我将在我身边尝试一下。刚刚尝试使用support lib 26和target framework 8.0,但未能重现该问题。您能在其他设备/模拟器上试用吗?@ElvisXia MSFT我用tablet emulator试用过,问题还是一样。我将Xamarin Forms降级为2.4.0.280,然后再试一次,但没有改变。同样的问题。您是否已卸载手机/模拟器中的应用程序,并重新生成应用程序?此外,你还需要在PCL和Xamarin.Android项目中降低lib的级别。是的,卸载应用程序后,它现在确实可以工作了。谢谢。这是一个xamarin表单错误,希望在以后的版本中可以修复,降级听起来不是一个最终的解决方案。