我试着用TabbedPage制作
UserTabbedPage.xaml
<?xml version="1.0" encoding="UTF-8"?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MyApp.General.Users.UserProfile;assembly=MyApp"
x:Class="MyApp.General.Users.UserProfile.UserTabbedPage">
<local:UserPage />
</TabbedPage>UserTabbedPage.xaml.cs
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace MyApp.General.Users.UserProfile
{
public partial class UserTabbedPage : TabbedPage
{
public UserTabbedPage()
{
InitializeComponent();
}
}
}UserPage.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"
x:Class="MyApp.General.Users.UserProfile.UserPage">
<ContentPage.Content>
</ContentPage.Content>
</ContentPage>UserPage.xaml.cs
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace MyApp.General.Users.UserProfile
{
public partial class UserPage : ContentPage
{
public UserPage(User user)
{
InitializeComponent();
}
}
}但我错了:字典中没有给定的键'Xamarin.Forms.Xaml.ElementNode‘
当我从User user中删除public UserPage(User user)时,错误就会消失。但是以后我需要在构造函数中使用这个类。
发布于 2018-09-26 08:11:47
通过添加不带参数的第二个构造函数来求解
https://stackoverflow.com/questions/52512546
复制相似问题