GithubHelp home page GithubHelp logo

Comments (8)

chrisriesgo avatar chrisriesgo commented on July 18, 2024

@amccorma - I'm having trouble replicating this issue. Do you have any additional steps that you can provide?

  • Did you change any code?
  • Are you testing on an emulator or real device?
  • Are your Android SDKs + build tools up to date?

from xamarin-forms-carouselview.

e862 avatar e862 commented on July 18, 2024

Hi chrisriesgo,
I do have the same issue. The only thing I did to the original code was:
Install-Package Xamarin.Forms -Version 1.5.0.6447
It fails here: HomePage.cs, View CreateTabs(), pagerIndicator.SetBinding(PagerIndicatorTabs.ColumnDefinitionsProperty, "Pages", BindingMode.Default, new SpacingConverter());

I then fell back to
Install-Package Xamarin.Forms -Version 1.4.4.6449
with the same issue.

Only going back to the original version of Xamarin Forms
Install-Package Xamarin.Forms -Version 1.4.2.6359
worked.

Device: Samsung Galaxy S6, Factory reset, nothing installed
SDK: Android SDK 5.1.1 (API22)

Thanks, crisriesgo for looking into this. Maybe my findings help to point in the right direction.
And thanks for the code! :) e862

from xamarin-forms-carouselview.

amccorma avatar amccorma commented on July 18, 2024

It has been a long time since I looked at it. I reviewed my solution that fixed the issue. I did a workaround and forgot to post it.

In PagerIndicatorTabs.cs, change ItemsSourceChanged to:

void ItemsSourceChanged ()
{
if (ItemsSource == null) return;

this.ColumnDefinitions.Clear ();
foreach(var item in ItemsSource)
{
this.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
}
CreateTabs();
}

In HomePage.cs change:

remove the binding for ColumnDefintions.

Xamarin.Forms.View CreateTabs()
{
var pagerIndicator = new PagerIndicatorTabs() { HorizontalOptions = LayoutOptions.CenterAndExpand };
pagerIndicator.RowDefinitions.Add(new RowDefinition() { Height = 50 });
pagerIndicator.SetBinding (PagerIndicatorTabs.ItemsSourceProperty, "Pages");
pagerIndicator.SetBinding (PagerIndicatorTabs.SelectedItemProperty, >"CurrentPage");
return pagerIndicator;
}

from xamarin-forms-carouselview.

e862 avatar e862 commented on July 18, 2024

Hi amccorma, and many thanks for quick response!
It works and it saved me quite some time. Greetings, e862

from xamarin-forms-carouselview.

Zilounay avatar Zilounay commented on July 18, 2024

This solution works but the dots/tabs now don't update anymore when swiping. I tested on iOS.

from xamarin-forms-carouselview.

ionixjunior avatar ionixjunior commented on July 18, 2024

Thank you @amccorma your workaround works perfectly. Tested on Android API 22, iOS 8.4 and 9.2.

@Zilounay you need a help for solve this?

from xamarin-forms-carouselview.

amccorma avatar amccorma commented on July 18, 2024

Zilounay: the issue with the dots is the event handler (command is not attached to the button)

In PagerIndicatorTabs.cs find CreateTabs method. at the button create code attach the command:

            var tgr = new TapGestureRecognizer();
            tgr.Command = new Command(() =>
            {
                SelectedItem = ItemsSource[index];
            });
            tab.GestureRecognizers.Add(tgr);
            Children.Add(tab, index, 0);

from xamarin-forms-carouselview.

chrisriesgo avatar chrisriesgo commented on July 18, 2024

Made some changes based on @amccorma's findings. Closing the issue.

from xamarin-forms-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.