我用Xamarin形式创建了MasterDetailPage但是当我试图运行应用程序时它给了我上面的错误。下面是我的MasterDetailPage的Xaml代码
R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS
locale:
[1] LC_CTYPE=pl_PL.UTF-8 LC_NUMERIC=C LC_TIME=pl_PL.UTF-8 LC_COLLATE=pl_PL.UTF-8
[5] LC_MONETARY=pl_PL.UTF-8 LC_MESSAGES=pl_PL.UTF-8 LC_PAPER=pl_PL.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=pl_PL.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] testthat_1.0.2 rmarkdown_1.0.9016 RevoUtilsMath_10.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.7 crayon_1.3.2 digest_0.6.10 assertthat_0.1 R6_2.1.3 formatR_1.4 magrittr_1.5
[8] evaluate_0.9 stringi_1.1.2 RevoUtils_10.0.1 tools_3.3.1 stringr_1.1.0 rsconnect_0.4.3 yaml_2.1.13
[15] htmltools_0.3.5 knitr_1.14 tibble_1.2
母版页的代码隐藏在
之下<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:App2;assembly=App2"
x:Class="App2.ParentsMenuPage">
<MasterDetailPage.Master>
<pages:ParentMasterPage x:Name="masterPage" />
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<pages:ParentHomePage />
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
The Xaml code for My Master Page is below
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App2.ParentMasterPage" Padding="0,40,0,0">
<ContentPage.Content>
<StackLayout VerticalOptions="FillAndExpand">
<ListView x:Name="listView" VerticalOptions="FillAndExpand" SeparatorVisibility="None">
<ListView.ItemTemplate>
<DataTemplate>
<ImageCell Text="{Binding Title}" ImageSource="{Binding IconSource}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
然后详细页面
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace App2
{
public class ParentMasterItem
{
public string Title { get; set; }
public string IconSource { get; set; }
public Type TargetType { get; set; }
}
public partial class ParentMasterPage : ContentPage
{
public ListView ListView { get { return listView; } }
public ParentMasterPage()
{
InitializeComponent();
var masterPageItems = new List<ParentMasterItem>();
masterPageItems.Add(new ParentMasterItem
{
Title = "Home",
IconSource = "images/home-small.png",
TargetType = typeof(ParentHomePage)
});
masterPageItems.Add(new ParentMasterItem
{
Title = "My Ward's",
IconSource = "images/ward-small.png",
TargetType = typeof(ParentWardsPage)
});
masterPageItems.Add(new ParentMasterItem
{
Title = "Chat",
IconSource = "images/chat-small.png",
TargetType = typeof(ParentChatPage)
});
listView.ItemsSource = masterPageItems;
}
}
}
请任何人帮我解决问题所在
答案 0 :(得分:0)