我正在尝试创建简单的多屏幕应用程序。
我添加了Content Page
和button
。
MapPage.xaml.cs
:
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MapPage : ContentPage
{
public MapPage ()
{
InitializeComponent ();
}
void ShowMap(object s, EventArgs e)
{
}
}
MapPage.xaml
:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App14"
x:Class="App14.MapPage">
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin Forms!" />
<Button Text="show map"
Clicked="ShowMap"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>
我收到错误:ShowMap Method does not have correct signature
我做错了什么?
答案 0 :(得分:1)
将事件处理程序从private
(默认情况下,如果未指定)更改为protected
protected void ShowMap(object s, EventArgs e)
{
}