当我在Xamarin应用程序中调用DisplayAlert时,屏幕消失,但未显示任何警报

问题描述 投票:1回答:1

我对Xamarin完全陌生,所以这可能确实很明显。但是,当我运行带有DisplayAlert调用的Xamarin应用程序时,屏幕消失,但没有对话框出现:

<Button x:Name="PlayButton" Text="Play" HorizontalOptions="CenterAndExpand" HeightRequest="100" WidthRequest="200" FontSize="64" Clicked="PlayButton_ClickedAsync"/>
private async void PlayButton_ClickedAsync(object sender, EventArgs e)
{
    await DisplayAlert("Play", "This is where we would start the game.", "OK");
}

如何使此警报实际显示?我正在用UWP应用进行测试,如果有关系,直到Android模拟器完成下载...

c# xaml xamarin xamarin.uwp
1个回答
-1
投票

不幸的是],当前版本的Xamarin Forms(4.6)中也存在此问题。

您可以将XF降级到4.4版本,使其现在可以作为解决方法。

降级请执行以下步骤:

  1. 右键单击项目解决方案
  2. 选择管理解决方案的Nuget程序包...
  3. enter image description here

  1. 找到已安装的xamarin表单nuget包,然后选择要安装的版本
  2. enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.