2016-12-30 56 views
1

當我想引用像Xlabs或DLToolkit這樣的下載包時,xamarin將始終引發錯誤。更具體地講,這裏是我的PCL項目從DLToolkitXamarin形成控制庫引用錯誤

引用FlowListView

繼承人的代碼示例:

<?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:controls="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms.Controls" 
      xmlns:flv="clr-namespace:DLToolkit.Forms.Controls;assembly=DLToolkit.Forms.Controls.FlowListView" 
      x:Class="TamarianApp.ImagePage"> 
     <ContentPage.Content> 
      <Grid> 
       <StackLayout x:Name="mainView"> 
        <ScrollView> 
         <StackLayout> 
          <BoxView Margin="0, -7, 0, 0" HorizontalOptions="FillAndExpand" HeightRequest="1" BackgroundColor="#f1f1f1"></BoxView> 
          <StackLayout x:Name="cameraMenuOption" Padding="10" Orientation="Horizontal" HorizontalOptions="Fill" > 
           <Label Margin="10, 2,0,0" HorizontalOptions="StartAndExpand">Camera</Label> 
           <Label x:Name="camera_label" Margin="10, 2,10,0" FontSize="14" TextColor="#c1c1c1" HorizontalOptions="End"></Label> 
           <Image HorizontalOptions="End" Source="icons/blue/next" WidthRequest="20"></Image> 
          </StackLayout> 
          <BoxView HorizontalOptions="FillAndExpand" HeightRequest="1" BackgroundColor="#f1f1f1"></BoxView> 
          <StackLayout x:Name="libraryMenuOption" Padding="10" Orientation="Horizontal" HorizontalOptions="Fill" > 
           <Label Margin="10, 2,0,0" HorizontalOptions="StartAndExpand">Library</Label> 
           <Label x:Name="library_label" Margin="10, 2,10,0" FontSize="14" TextColor="#c1c1c1" HorizontalOptions="End"></Label> 
           <Image HorizontalOptions="End" Source="icons/blue/next" WidthRequest="20"></Image> 
          </StackLayout> 
         </StackLayout> 
        </ScrollView> 
        <StackLayout BackgroundColor="#fafafa" HorizontalOptions="FillAndExpand" > 
         <BoxView HorizontalOptions="FillAndExpand" HeightRequest="3" BackgroundColor="#f1f1f1"></BoxView> 
        </StackLayout> 
        <StackLayout> 
         <flv:FlowListView FlowColumnCount="3" x:Name="image_gallary"> 
          <FlowListView.ItemTemplate> 
           <DataTemplate> 
            <Grid> 
             <Image Source="{Binding ImageUri}"></Image> 
            </Grid> 
           </DataTemplate> 
          </FlowListView.ItemTemplate> 
         </flv:FlowListView> 
        </StackLayout> 
       </StackLayout> 
       <StackLayout x:Name="picture_view" IsVisible = "false"> 
        <Image x:Name="mainImage" VerticalOptions="Fill" HorizontalOptions="Fill"></Image> 
        <ActivityIndicator x:Name="loading_activity" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" IsRunning="false"></ActivityIndicator> 
        <StackLayout x:Name="confirm_button" HorizontalOptions="FillAndExpand" Orientation="Horizontal" Padding="15, 10, 15, 10" VerticalOptions="EndAndExpand" BackgroundColor="White"> 
         <Button Text="Confirm" Clicked="upload_clicked" HorizontalOptions="StartAndExpand" FontSize="18"></Button> 
         <Button Text="Cancel" Clicked="cancel_clicked" HorizontalOptions="End" FontSize="18"></Button> 
        </StackLayout> 
       </StackLayout> 
      </Grid> 
     </ContentPage.Content> 
    </ContentPage> 

以下是錯誤:

位置32:9。 1.增加FlowListView.Init()來AppDelegate.cs 2.初始化上後端控制::類型FlowListView不在的xmlns http://xamarin.com/schemas/2014/forms

我試圖發現image_gallary =新FlowListView();

請大家幫忙,謝謝!

回答

0

而不是<FlowListView.ItemTemplate>也聲明它像<flv:FlowListView.ItemTemplate>和結尾標記。您需要確定這些對象所在的命名空間。

當沒有前綴時,它會認爲它在默認名稱空間中。但事實並非如此。因此,與FlowListView有關的所有內容都必須以命名空間作爲前綴,在您的案例中爲flv