我正在尝试在 Xamarin 中制作 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();
}
}
}
用户页面.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>
用户页面.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)
. 但是我需要稍后在构造函数中使用这个类。