2017-07-31 95 views
1

我想創建簡單的多屏幕應用程序。Xamarin:方法沒有正確的簽名

我加了Content Pagebutton

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

檢查事件處理程序,如果這有助於解決您的問題:https://stackoverflow.com/questions/38067982/button-does - 不是,有最正確的簽名-xamarin(https://stackoverflow.com/questions/38067982/button-does-not-have-the-correct-signature-xamarin) – Habeeb

回答

1

變化從private(如果未指定默認值)protected

protected void ShowMap(object s, EventArgs e) 
     { 

     } 
相關問題