Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FlowListView not working correctly with a simple example

I created a basic FlowListView but I cant seem to get it working. It works ok with a basic Xamarin ListView but when switched over to FLowListView it only shows the correct number of rows but they are empty.

Where am I going wrong?

 <?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:flv="clr-namespace:DLToolkit.Forms.Controls;assembly=DLToolkit.Forms.Controls.FlowListView" xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="rateStyle.ReviewPage">
<ContentPage.Content>
    <StackLayout Orientation="Horizontal">
        <flv:FlowListView x:Name="listy" FlowColumnCount="2" SeparatorVisibility="None" HasUnevenRows="true">
            <flv:FlowListView.FlowColumnTemplate>
                <DataTemplate>
                    <StackLayout>
                        <Label Text="{Binding Title}" />
                        <!--
                        <Image Source="{Binding Picture}" />
                        -->
                    </StackLayout>
                </DataTemplate>
            </flv:FlowListView.FlowColumnTemplate>
        </flv:FlowListView>
    </StackLayout>
</ContentPage.Content>

public partial class ReviewPage : ContentPage
{
    public ReviewPage()
    {
        InitializeComponent();

        var data = new List<Outfit>();
        var a = new Outfit { Title = "aaa", Picture="https://farm9.staticflickr.com/8625/15806486058_7005d77438.jpg" };
        var b = new Outfit { Title = "bbb", Picture = "https://farm5.staticflickr.com/4011/4308181244_5ac3f8239b.jpg" };
        var c = new Outfit { Title = "ccc", Picture = "https://farm8.staticflickr.com/7423/8729135907_79599de8d8.jpg" };

        data.Add(a); data.Add(b); data.Add(c);

        listy.ItemsSource = data;
    }
}
like image 907
fractal Avatar asked Dec 18 '25 01:12

fractal


1 Answers

In case you haven't figured this bit out yet, you need to set FlowItemsSource, not ItemSource. Like this:

public partial class ReviewPage : ContentPage
{
    public ReviewPage()
    {
        InitializeComponent();

        var data = new List<Outfit>();
        var a = new Outfit { Title = "aaa", Picture="https://farm9.staticflickr.com/8625/15806486058_7005d77438.jpg" };
        var b = new Outfit { Title = "bbb", Picture = "https://farm5.staticflickr.com/4011/4308181244_5ac3f8239b.jpg" };
        var c = new Outfit { Title = "ccc", Picture = "https://farm8.staticflickr.com/7423/8729135907_79599de8d8.jpg" };

        data.Add(a); data.Add(b); data.Add(c);

        listy.FlowItemsSource = data;
    }
}
like image 52
outbred Avatar answered Dec 21 '25 12:12

outbred



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!