2017-07-16 11 views
-1

採取這些代碼? 錯誤:在UWP</p> <pre><code><StackLayout > <local:page1 /> </StackLayout> </code></pre> <p>什麼是xamarin.forms的等效代碼(本地第1頁)在xamarin.forms

<?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="Haill_Xamarin.MainPage"> 
    <ContentPage.Content> 
     <StackLayout> 
      <local:page1 /> // error this code in xamarin.forms 
     </StackLayout>  
    </ContentPage.Content> 
</ContentPage> 
+2

您是否有在XAML中定義的本地名稱空間?如果您收到錯誤消息,通常會告訴我們錯誤是什麼。 – Jason

+0

錯誤\t \t'local'是一個未聲明的前綴。第20行,第18位。 – Abdullah

回答

0

你應該聲明你的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" 
    xmlns:local="clr-namespace:Haill_Xamarin;assembly=Haill_Xamarin" 
      x:Class="Haill_Xamarin.MainPage"> 
    <ContentPage.Content> 
     <StackLayout> 
      <local:page1 /> 
     </StackLayout> 
    </ContentPage.Content> 
</ContentPage> 
+0

我更新代碼,但不是修女,請更新代碼。 – Abdullah

+0

我更新了它應該在你的情況。但是,您可能想要檢查此時是否還有'page1'。如果你不理解這個部分,那麼你在這裏需要的不僅僅是一個問題。考慮進一步學習和研究,或尋求其他網站的幫助。 –

+0

錯誤(未能解析程序集:'Haill_Xamarin,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = null') – Abdullah

相關問題