Dmitry Bubnenkov
Dmitry Bubnenkov

Reputation: 9859

Xamarin: Method does not have correct signature

I am trying to create simple multi-screen App.

I added Content Page and button to it.

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>

I am getting error: ShowMap Method does not have correct signature

What I am doing wrong?

Upvotes: 1

Views: 1916

Answers (1)

Jason
Jason

Reputation: 89082

change the event handler from private (the default if not specified) to protected

protected void ShowMap(object s, EventArgs e)
        {

        }

Upvotes: 1

Related Questions