2016-06-28 1 views
0

xamarinフォームでマスターページの詳細を作成しようとしています。単純なロジックで、ユーザーはナビゲーションページ内のボタンをクリックし、詳細ページにいくつかのパラメーターを送り、私は、RESTサービスからリストビューを結合するが、私は、詳細ページへのparamsを送るカント、私はこの方法を使用していますが、それでも私のマスターページが、このxamarinフォームのマスターからディテールにいくつかのパラメーターを送る

<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> 

のようなものですエラー

private void Button_OnClicked(object sender, EventArgs e) 
     { 

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

を得ましたそして私の詳細ページはこのようなものです

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

ご協力いただきありがとうございます。私は、IOSのリンカを無効にするが、それでもまったく同じ

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 を書いた 誤りがあり、何も変わりません。

+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"> 
関連する問題