好日子每個人。我正在做一個Xamarin.Forms便攜式應用程序,其中我創建了兩個視圖MainPageMain.xaml和SecondPage.xaml在App.cs,我已經把我的根頁面MainPageMain但我想將其更改爲SecondPage。無法找到類型或名稱空間名稱'PROJECTNAME'(您是否缺少使用指令或程序集引用?
每次我改變了它,出現此錯誤:
無法找到類型或命名空間名稱'PROJECTNAME'(您是否缺少using指令或程序集引用?
背後有什麼原因呢?如果您需要更多代碼,請告訴我。
這是我SecondPage.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="XamarinFormsDemo.Views.SecondPage"
BackgroundColor="Teal">
<Label Text="Sample Here!" VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>
這是我SecondPage.xaml.cs代碼:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using XamarinFormsDemo.Views;
namespace XamarinFormsDemo.Views
{
public partial class SecondPage : ContentPage
{
public SecondPage()
{
InitializeComponent();
}
}
}
App.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;
namespace XamarinFormsDemo
{
public class App : Application
{
public App()
{
// The root page of your application
MainPage = new NavigationPage(new SecondPage());
}
protected override void OnStart()
{
// Handle when your app starts
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}
當然可以。但是我需要發佈什麼代碼? –
您應該檢查'SecondPage'類在您的代碼中的位置。我想你會得到你的答案。另外,請檢查'SecondPage'類的'xaml'表單。 – vivek
我編輯了我的帖子,先生。 –