1
votes

When I want to reference a downloaded package like Xlabs or DLToolkit, xamarin will always throw an error. More specifically here is an example of my PCL project referencing the FlowListView from DLToolkit

Heres the code:

<?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>

Here is the Error:

Position 32:9. Type FlowListView not found in xmlns http://xamarin.com/schemas/2014/forms

I have tried: 1. Added FlowListView.Init() to AppDelegate.cs 2. Initializing control on backend: image_gallary = new FlowListView();

Please help, thanks!

1

1 Answers

0
votes

Instead of <FlowListView.ItemTemplate> also declare it like <flv:FlowListView.ItemTemplate> and also on the ending tag. You need to determine in which namespace these objects live.

When there is no prefix, it will assume it is in the default namespace. But it isn't. So everything that has to do with the FlowListView has to be prefixed with the namespace, in your case flv.