Cardview: Views sometimes don't render when adding or removing from ObservableCollection

Created on 8 Jun 2019  Â·  3Comments  Â·  Source: AndreiMisiukevich/CardView

I have a CarouselView bound to a collection of ContentViews.

<cards:CarouselView ItemsSource="{Binding Lists}" SelectedItem="{Binding CurrentList}"  HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                    <cards:CarouselView.ItemTemplate>
                        <DataTemplate>
                            <ContentView Content="{Binding}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                            </ContentView>
                        </DataTemplate>
                    </cards:CarouselView.ItemTemplate>
                </cards:CarouselView>
public ObservableCollection<ContentView> Lists { get; set; }

All works well on initial load, but when I add items:

var page = new ListPage { Name = e.Name, ShowChecked = false, Sort = 1, CreatedDate = DateTime.Now, LastUpdateDate = DateTime.Now };
Lists.Add(new ListItemView(page));
CurrentList = Lists[CurrentIndex];

(ListItemView is a simple ContentView.)

Sometimes the view doesn't render, and I end up with a blank page. If I stop and restart the app, the new view renders as expected.

This also seems to happen when I delete an item from the collection. Has anyone else run into this issue? Am I doing something wrong?

I would love to use this control, but I need it to render the view consistently.

cannot reproduce question resolved

All 3 comments

Hi, provide sample please

Thanks for responding. I've found that if I turn off Caching (IsViewCacheEnabled="False") I don't have the issue, but then it's extremely slow. I'll try to put together a sample, but on a tight deadline right now. We've decided to go with a different approach for now.


From: "Andrei" notifications@github.com
Sent: Saturday, June 8, 2019 12:43 PM
To: "AndreiMisiukevich/CardView" CardView@noreply.github.com
Cc: "SkeletonJohn" john@skeletonshores.com, "Author" author@noreply.github.com
Subject: Re: [AndreiMisiukevich/CardView] Views sometimes don't render when adding or removing from ObservableCollection (#210)

Hi, provide sample please
I presume, there is some bug in your solution )

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

We were unable to re-create this in a small sample project. We re-implemented it in out project and it seems to be working as expected. I'm not sure exactly what happened. Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jungjanos picture jungjanos  Â·  8Comments

IgorPopov56 picture IgorPopov56  Â·  4Comments

baranpirincal picture baranpirincal  Â·  4Comments

stealthcold picture stealthcold  Â·  6Comments

JTOne123 picture JTOne123  Â·  5Comments