Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically slide to next Panorama item

Is it possible to programmatically move from one panorama page/item to the next and get the same kind of animated sliding effect you get when sliding with a finger?

I can use the PanoramaControl.DefaultItem property to move to the expected item/page, but you won't get the animated sliding effect. Any ideas here?

like image 853
Johan Danforth Avatar asked Mar 18 '11 09:03

Johan Danforth


2 Answers

Its possible, just put the setting of the DefaultItem between a SlideTransition Completed event and you are done:

public static class PanoramaExtensions
{
    public static void SlideToPage(this Panorama self, int item)
    {

        var slide_transition = new SlideTransition() { };
        slide_transition.Mode = SlideTransitionMode.SlideLeftFadeIn;
        ITransition transition = slide_transition.GetTransition(self);
        transition.Completed += delegate
        {
            self.DefaultItem = self.Items[item];
            transition.Stop();
        };
        transition.Begin();
    }
}

Use my_panorama.SlideToPage(1) to slide to the second page.

like image 182
Herman van der Blom Avatar answered Oct 19 '22 19:10

Herman van der Blom


You can use below code :

panoramaRoot.DefaultItem = (PanoramaItem)panoramaRoot.Items[1];
like image 43
Sajjan Kumar Avatar answered Oct 19 '22 18:10

Sajjan Kumar