question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FlowListView] Trying to use it coming from ListView

See original GitHub issue

Hi,

My problem is that I was using ListView but it didn’t accomplish my goals and I seen that the most useful thing would be to use FlowListView. I addapted my code and the GUI don’t show me any kind of data in the implied page. Before that change ListView was showing all data in “factors” and now I can’t see anything.

What I had was:

C# HomeViewModel.cs

using System;
using System.ComponentModel;
using System.Collections.ObjectModel;
using HotelSaver.Models;

namespace HotelSaver.ViewModel
{
    public static class HomeViewModel
    {
        public static ObservableCollection<Factor> factors {
            get;
            set;
        }
        static HomeViewModel()
        {
            HomeViewModel.factors = DataSource.getFactors();
        }
    }
}

XAML HomePage.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"
             x:Class="HotelSaver.HomePage"
             Title="Inici"
             xmlns:local="clr-namespace:HotelSaver.ViewModel;assembly=HotelSaver">
    <ContentPage.Content>
            <ListView x:Name="FactorsListView" SeparatorVisibility="None" ItemsSource="{x:Static local:HomeViewModel.factors}" ItemSelected="listSelection">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout Orientation="Horizontal">
                                <Label Text="{Binding name}" HorizontalOptions="CenterAndExpand" FontSize="18" />
                                <Label Text="100%" TextColor="Green" HorizontalOptions="End" />
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
    </ContentPage.Content>
</ContentPage>

And know I changed the XAML to:

XAML HomePage.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"
             x:Class="HotelSaver.HomePage"
             Title="Inici"
             xmlns:local="clr-namespace:HotelSaver.ViewModel;assembly=HotelSaver"
             xmlns:flv="clr-namespace:DLToolkit.Forms.Controls;assembly=DLToolkit.Forms.Controls.FlowListView">
    <ContentPage.Content>
            <flv:FlowListView x:Name="FactorsView" FlowColumnCount="3" SeparatorVisibility="None" HasUnevenRows="False" FlowItemsSource="{x:Static local:HomeViewModel.factors}" FlowItemTappedCommand="listSelection">
                <flv:FlowListView.FlowColumnTemplate>
                    <DataTemplate>
                        <Label Text="{Binding name}" HorizontalOptions="CenterAndExpand" XAlign="Center" YAlign="Center" FontSize="18" />
                        <Label Text="100%" TextColor="Green" XAlign="Center" YAlign="Center" HorizontalOptions="CenterAndExpand" />
                    </DataTemplate>
                </flv:FlowListView.FlowColumnTemplate>
    </ContentPage.Content>
</ContentPage>

I don’t know what I’m doing bad. I inserted FlowListView.Init(); in App.xaml.cs and everything needed…

Thank you for your time.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
vlkamcommented, Jan 7, 2019

Yes, in HomePage.xaml.cs right before InitializeComponent();

The ViewModel which doesn’t implement INotifyPropertyChanged, static fields, the View without bindings… it’s very unusual schema. I think problem in that

0reactions
angelrucommented, Jan 16, 2019

@guiu23 but does it work with <flv:FlowListView.ItemTemplate> ?

loadingcommand not work…

Read more comments on GitHub >

github_iconTop Results From Across the Web

FlowListView not fully updating UI when changing ...
try with this class (from xamarin) and pass ienumerable of card instead card only object. ... removed, or when the whole list is...
Read more >
Could not load file or assembly 'DLToolkit.Forms.Controls. ...
Hi! I've just added the FlowListView to my project but I can't get it to work. I get a FileNotFoundException on DLToolkit.Forms.Controls.
Read more >
ListView - .NET MAUI
ListView can be populated with data by using data binding to bind its ItemsSource property to an IEnumerable collection.
Read more >
Salesforce Flow In List Views - YouTube
Welcome to another video on Salesforce Flow. In this video, I have focused on creating a flow which can be used in List...
Read more >
The 0th index of the ListView I showed in the popup is not ...
In this application, I make a popup displaying options with flowlistview (DLToolkit.Forms.Controls) in Rg.Plugins.Popup.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found