我正在尝试显示,当我单击“ OnLogOut”时显示警报,但它不令人担心,我看不到原因
<StackLayout Grid.Row="1" BackgroundColor="White" HorizontalOptions="FillAndExpand" Orientation="Vertical" VerticalOptions="FillAndExpand" Spacing="30" Padding="0,0,0,0">
<StackLayout Orientation="Horizontal" HorizontalOptions="Center">
<!--Le text est dans la classe-->
<Label x:Name="myemail" Text="" TextColor="#36688D" Font="Bold,Italic,20" />
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalOptions="Center">
<Label HorizontalOptions="Center"
TextColor="#36688D"
FontSize="15"
Text="Log Out" x:Name="mylogout">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="OnLogOut" />
</Label.GestureRecognizers>
</Label>
</StackLayout>
</StackLayout>
这是我的C#代码:
public async void OnLogOut(object sender, EventArgs args)
{
Console.WriteLine("Log out is tapped");
await DisplayAlert("Email", "Your email please", "✔");
}
预先感谢