Giter VIP home page Giter VIP logo

Comments (14)

tematim avatar tematim commented on June 3, 2024

Update : I manage to add actions to the control and call implementations inside the renderer.

Now, I try to switch page programmatically :
public void ScrollNext()
{
var currentItem = pageController.ViewControllers.FirstOrDefault();
pageController.GetNextViewController.Invoke(pageController, currentItem);
currentItem = pageController.ViewControllers.FirstOrDefault();
var item = (ViewContainer) currentItem;
var position = item.Tag + 1;
Element.Position = position;
Element.RaiseSelectionChanged(new SelectedPositionChangedEventArgs(position));
}

The invoke go to the right line to createContent at the new position. But the image still the same.

How can I refresh the view to display the correct image ?

Regards

from carouselview.

alexrainman avatar alexrainman commented on June 3, 2024

If what you want to do is move to next/prev page programmatically, use setCurrentPage(position).

from carouselview.

tematim avatar tematim commented on June 3, 2024

Hello,

It's working, but the view is sliding to the wrong direction.

The natural way is to slide right to left to display the next item, but when I use the setCurrentController, the slide is left to right.
So the next item appear to come from left and not right.

Is it possible to change it ?

Regards

from carouselview.

alexrainman avatar alexrainman commented on June 3, 2024

I don't know what are yo doing in your end but you should not use setCurrentController directly. You should use SetCurrentPage(position).

Please, take a look at the demo, you will find to methods to move back and fort from PCL.

public void OnPrev (object sender, TappedEventArgs e)
{
    if (myCarousel.Position > 0)
        myCarousel.SetCurrentPage(myCarousel.Position - 1);
}

public void OnNext(object sender, TappedEventArgs e)
{
    if (myCarousel.Position < myCarousel.ItemsSource.Count - 1)
        myCarousel.SetCurrentPage(myCarousel.Position + 1);
}

Thanks.

from carouselview.

tematim avatar tematim commented on June 3, 2024

Hello,

I work on the iOS renderer. The SetCurrentPage isn't available for the Element. or pageController.
So I use the setCurrentController.

If I use the setCurrentPage, this change nothing, the image displayed doesn't change.

Any suggestions ?

Regards

from carouselview.

alexrainman avatar alexrainman commented on June 3, 2024

Why you need to work directly in the iOS renderer? This is a XForms plugin. You suposed to use it from PCL with the provided cross-platform methods.

from carouselview.

tematim avatar tematim commented on June 3, 2024

I manage to use your code and display a carousel.

Now, I have an issue with a cache. Because I open the carousel, I dispose it, and when I try to display a new one with a different ItemsSource, the carousel isn't displayed.

The itemsSource changed event is correctly called, the items source is correctly getted from the VM.

Any suggestions to display the new content ?

Regards

from carouselview.

alexrainman avatar alexrainman commented on June 3, 2024

How are you pushing the new page?

from carouselview.

tematim avatar tematim commented on June 3, 2024

Hello,

I change the current VM with a navigation service and a new presentationMessage part of a Galasoft.Messenger.

private void OpenPresentation(PresentationMessage obj)
{
DocumentsControl.ItemsSource = App.Locator.PresentationVM.Documents;
_isClosing = false;
Opacity = 1;
UpdateArrowVisibility();
if (DocumentsControl.ItemsSource.Count > 0 && DocumentsControl.Position != -1)
DocumentInformation.BindingContext = DocumentsControl.ItemsSource[DocumentsControl.Position];
_isHeaderExpand = false;
_isHeaderReduced = true;
_isFooterExpand = false;
ExpandControl(0); // Not expanding the description of the current item
}

What is different between the first creation of the control and his "reuse" ? What I need to add to display the new content correctly ?

Regards

from carouselview.

alexrainman avatar alexrainman commented on June 3, 2024

What this means: ExpandControl(0);?

from carouselview.

tematim avatar tematim commented on June 3, 2024

It's an inside method, to expand the description of the currentItem stored in another object, nothink link with the carousel issue.

from carouselview.

alexrainman avatar alexrainman commented on June 3, 2024

I don't really know what are you doing, not without the whole code :(

from carouselview.

alexrainman avatar alexrainman commented on June 3, 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 3, 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.