我的xaml中有此代码:
<Image Source="Record"
WidthRequest ="200"
HeightRequest="158">
<Image.GestureRecognizers>
<TapGestureRecognizer x:Name="ImgRecord"
Tapped="ImgRecord_Tapped"
NumberOfTapsRequired="1"/>
</Image.GestureRecognizers>
</Image>
此为我的CS:
private async void ImgRecord_Tapped(object sender, EventArgs e)
{
try
{
//Code to execute on tapped event
await Navigation.PushAsync(new Record());
}
catch (Exception ex)
{
throw ex;
}
}
它给我一个错误System.FormatException Message =已识别的项目之一格式无效。
当我单击img时,我需要重定向到另一页。
它给我一个错误System.FormatException Message =所标识的项之一格式无效。因为您没有为图像提供正确的图像源格式。图片来源应为a.png,b.jpg等。请修改您的图片来源,我使用以下代码,但未发现任何问题。