2017-07-25 13 views
0

步驟1:創建新項目PCL的xmlns:對照= 「CLR-名稱空間:XLabs.Forms.Controls;裝配= XLabs.Forms」 這是找不到

步驟2:添加Xlabs從NuGet包形成DLL管理器(版本:2.0.5782)

步驟3:然後,我添加在MainPage.xaml中文件此以下代碼

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
      xmlns:local="clr-namespace:App2" 
      xmlns:controls="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms" 
      x:Class="App2.MainPage"> 
<StackLayout> 
     <controls:WrapLayout></controls:WrapLayout> 
    </StackLayout> 
</ContentPage> 


using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Xamarin.Forms; 

namespace App3 
{ 
    public partial class MainPage : ContentPage 
    { 
     public MainPage() 
     { 
      InitializeComponent(); 
     } 
    } 
} 

步驟4:然後在UWP運行此項目

1

步驟5:我得到這個錯誤

如果任何人有任何想法,請幫助我........

+0

沒有圖片,沒有錯誤在您的問題中可見。順便說一句,XLabs已棄用 –

+0

您好@YuriS我在第4步中附加了該異常。它是運行時異常。在運行應用程序時(注意:在Visual Studio中啓用異常)現在您可以看到該錯誤。 –

+0

錯誤很明顯。 wraplayout不在XLabs.Forms.Controls命名空間中。使用對象資源管理器來查看包裝文件的命名空間,如果它甚至存在於xlabs中。正如我所說,我根本不會使用xlabs。它不見了 –

回答

1

我解決它(我認爲這是不正確的方式)但我發現問題。它是不會在應用程序加載時初始化的。所以我嘗試下面的代碼。

我試圖在initializeComponent()之前初始化我的XLab dll。

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Xamarin.Forms; 
using XLabs.Forms.Controls; 

namespace App3 
{ 
    public partial class MainPage : ContentPage 
    { 
     public MainPage() 
     { 
      WrapLayout wp = new WrapLayout(); 
      InitializeComponent(); 
     } 
    } 
} 
相關問題