2016-06-28 15 views
0

我試圖在xamarin forms中創建一個masterpage的詳細信息。簡單的邏輯,用戶將點擊導航頁面中的按鈕,然後它會發送一些參數到詳細頁面,並根據該參數我將結合從靜止服務列表視圖,但我不能發送PARAMS的詳細信息頁面,我用這個方法,但仍然有錯誤發送一些參數以詳細描述來自master的xamarin形式

private void Button_OnClicked(object sender, EventArgs e) 
     { 

      var item = (Xamarin.Forms.Button)sender; 
       Navigation.PushAsync(new PageDetay(item.CommandParameter.ToString())); 
     } 

我的母版頁是這樣的

<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" 
      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
      x:Class="paux.Pages.PageMaster" xmlns:local="clr-namespace:paux;assembly=paux"> 
<MasterDetailPage.Master> 
    <ContentPage Title="My page"> 
    <StackLayout Orientation="Vertical"> 
     <ListView x:Name="lstViewMaster" RowHeight="36" > 
      <ListView.ItemTemplate> 
      <DataTemplate> 
       <ViewCell> 
        <ViewCell.View> 
        <Button Text = "{Binding ad}" CommandParameter="{Binding no}" Clicked="Button_OnClicked"/> 
       </ViewCell.View> 
       </ViewCell> 
      </DataTemplate> 
      </ListView.ItemTemplate> 
     </ListView> 
    </StackLayout> 
    </ContentPage> 
</MasterDetailPage.Master> 
    <MasterDetailPage.Detail> 
<local:Pages.PageDetay/> 
    </MasterDetailPage.Detail> 
</MasterDetailPage> 

而我的詳細信息頁面是這樣的

public PageDetay(string id) 
     { 
      InitializeComponent(); 
     } 

任何幫助表示讚賞,謝謝。 錯誤是完全

namespace paux.Pages { 
using System; 
using Xamarin.Forms; 
using Xamarin.Forms.Xaml; 


public partial class PageMaster : global::Xamarin.Forms.MasterDetailPage { 

    [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Forms.Build.Tasks.XamlG", "0.0.0.0")] 
    private global::Xamarin.Forms.ListView lstViewMaster; 

    [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Forms.Build.Tasks.XamlG", "0.0.0.0")] 
    private void InitializeComponent() { 
     this.LoadFromXaml(typeof(PageMaster)); // this is source of the error 
     lstViewMaster = this.FindByName<global::Xamarin.Forms.ListView>("lstViewMaster"); 
    } 

} 

} 一些xamarin用戶的投訴了這個錯誤,並寫了這https://forums.xamarin.com/discussion/25938/missingmethod-exception-default-constructor-not-found 我在IOS禁用鏈接,但仍然一樣,沒有什麼變化。

+0

你會得到什麼錯誤? – jzeferino

+0

對不起,我忘了寫,錯誤是「System.MissingMethodException:未找到類型paux.Pages.PageDetay的默認構造函數」 – slayer35

+0

如果您可以請分享完整的代碼。我無法複製這個問題。 – jzeferino

回答

0

我的問題與標題有關,我錯過了我的Xaml MasterPage中的標題。在你的lstViewMaster.xaml中你有標題?

<?xml version="1.0" encoding="utf-8" ?> 
<ContentPage 
    xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    ... 
    Title="Your title">