Giter VIP home page Giter VIP logo

Comments (9)

alexrainman avatar alexrainman commented on June 12, 2024

Can you elaborate a little more?

from carouselview.

sdebruyn avatar sdebruyn commented on June 12, 2024

It seems like the Android renderer doesn't call viewPager.Adapter.NotifyDataSetChanged(); when the amount of items in the ItemsSource changes.
What I'd recommend to fix (I'll do a PR in an hour or so):

  1. Check if the ItemsSource implements INotifyCollectionChanged.
  2. If it does, subscribe to the CollectionChanged event.
  3. When the event is called, call viewPager.Adapter.NotifyDataSetChanged(); in the renderer.

from carouselview.

alexrainman avatar alexrainman commented on June 12, 2024

In the plugin, im always calling NotifyDataSetChanged when any changes happen. The problem seems to be that you are deleting all the items and ViewPager needs at least one, and when pop back, something weird happens. I will review it.

from carouselview.

alexrainman avatar alexrainman commented on June 12, 2024

If you take a look at the code you will confirm that it does :)

from carouselview.

alexrainman avatar alexrainman commented on June 12, 2024

It seems you are deleting the Items from ItemsSource directly. Instead, use what the Carousel API offers:

carousel.RemovePage(position);

This will remove the page and the item from the source. Anyway, i will implement your advice and make the ItemsSource and observable collection if it's not already.

Thanks

from carouselview.

alexrainman avatar alexrainman commented on June 12, 2024

For now the control core supports ObservableCollections but don't support INotifyCollectionChanged event. Anyway, you can use it CollectionChanged in your own code for your own business logic. If you want to remove/add elements to carousel, use the provided API.

from carouselview.

alexrainman avatar alexrainman commented on June 12, 2024

As all the native components behave different on each platform and, took me a while to make them work in the same way, that's way i am handling removing/adding pages at core level because sometimes you need to remove the item from the source after removing the UI object and that wont be the case if i use CollectionChanged event, where the item will be always removed from the collection before the UI object. Anyway, i will do my round of testing. I believe if i do this change it will mean a huge change in the control that will brake previous version people are using already. Thanks

from carouselview.

alexrainman avatar alexrainman commented on June 12, 2024

If my work is helping you, please help me back: https://xamarinhq.wufoo.com/forms/nominate-a-xamarin-mvp/

from carouselview.

alexrainman avatar alexrainman commented on June 12, 2024

This is what i have done that is community visible:

  • Alex has been pretty active sharing his knowledge and answering questions in StackOverflow, GitHub and Xamarin Forums.
  • Alex has been open sourcing Xamarin components and plugin with the community, with more of 10 repositories being maintained on GitHub.
  • One of Alex's Xamarin.Forms plugin, the CarouselView, is currently being pulled into the Xamarin.Forms core (xamarin/Xamarin.Forms#853). As an stable widget, this control has become the standard for Xamarin.Forms carousel screens with more that 16K downloads in NuGet and more than 100 solved and not open issues.
  • Another Alex's plugin, the SegmentedControl (https://github.com/alexrainman/SegmentedControl), is a big candidate to be also pulled into Xamarin.Forms core.
  • Plus Xamarin.Forms UI related plugins, Alex shares plugins to set app icon Badge, Google Analytics and KeyChain access.
  • Alex shares his knowledge about cutting edge technologies like Couchbase NoSQL and MobileIron integration with Xamarin Apps.

from carouselview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.