Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3488368
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:15:44+00:00 2026-05-18T11:15:44+00:00

I have stack of images in a grid and i want to implement a

  • 0

I have stack of images in a grid and i want to implement a slide show for it.I am using Microsoft VS 2010 Express Edition for Windows phone for implemenitng this.Can someone help ? The code is :

 using System;
 using System.Collections.Generic;

 using System.Windows.Threading;

  namespace swipe
 {
 public partial class MainPage : PhoneApplicationPage
{
 // private DispatcherTimer tmr = new DispatcherTimer();

private List<string> images = new List<string>();

private int imageIndex = 0;

public MainPage()
{
    InitializeComponent();

    Loaded += new RoutedEventHandler(MainPage_Loaded);
}

void MainPage_Loaded(object sender, RoutedEventArgs e)
{
   // tmr.Interval = TimeSpan.FromSeconds(5);
   // tmr.Tick += new EventHandler(tmr_Tick);

    LoadImages();

    ShowNextImage();
}

private void LoadImages()
{
    images.Add("/images/Hydrangeas.jpg");
    images.Add("/images/Jellyfish.jpg");
    images.Add("/images/Koala.jpg");
    images.Add("/images/Tulips.jpg");
}

private void ShowNextImage()
{
   // String bi = new BitmapImage(new Uri(images[imageIndex], UriKind.Relative));

    myImg.Source = new BitmapImage(new Uri(images[imageIndex], UriKind.Relative));

    imageIndex = (imageIndex + 1) % images.Count;
   }

   //void tmr_Tick(object sender, EventArgs e)
   //{
   //    ShowNextImage();
   //}

 protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
   {
    //if (!tmr.IsEnabled)
    //{
    //    tmr.Start();
    //}

    base.OnNavigatedTo(e);
 }
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
    //tmr.Stop();

    base.OnNavigatedFrom(e);
}

private void Play_Click(object sender, RoutedEventArgs e)
{
    ShowNextImage();
}

 }
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:15:45+00:00Added an answer on May 18, 2026 at 11:15 am

    Here’s a quick example of one way of doing this. It doesn’t use a grid of images but I’m sure you can adjust this as you need to.

    Edit: reread the title. If you want this to advance on button click get rid of the timer and call ShowNextImage() in the click event.

    The page includes the following XAML:

    <Image x:Name="myImg" />
    

    The code behind looks like:

    private DispatcherTimer tmr = new DispatcherTimer();
    
    private List<string> images = new List<string>();
    
    private int imageIndex = 0;
    
    public MainPage()
    {
        InitializeComponent();
    
        Loaded += new RoutedEventHandler(MainPage_Loaded);
    }
    
    void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
        tmr.Interval = TimeSpan.FromSeconds(5);
        tmr.Tick += new EventHandler(tmr_Tick);
    
        LoadImages();
    
        ShowNextImage();
    }
    
    private void LoadImages()
    {
        // list the files (includede in the XAP file) here
        images.Add("/images/filename1.jpg");
        images.Add("/images/filename2.jpg");
        images.Add("/images/filename3.jpg");
        images.Add("/images/filename4.jpg");
    }
    
    private void ShowNextImage()
    {
        var bi = new BitmapImage(new Uri(images[imageIndex], UriKind.Relative));
    
        myImg.Source = bi;
    
        imageIndex = (imageIndex + 1) % images.Count;
    }
    
    void tmr_Tick(object sender, EventArgs e)
    {
        ShowNextImage();
    }
    
    protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
    {
        if (!tmr.IsEnabled)
        {
            tmr.Start();
        }
    
        base.OnNavigatedTo(e);
    }
    
    protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
    {
        tmr.Stop();
    
        base.OnNavigatedFrom(e);
    }
    

    Sample code which shows using a button to advance code can be downloaded from http://cid-cc22250598bf7f04.office.live.com/self.aspx/Public/SlideShowDemo.zip

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stack of 2D dicom images and want to convert to a
I have a stack of images on which I want to perform some operations.
I have an image stack of 500 images (jpeg) of 640x480. I intend to
i have a stack of messages in database table. i want to send these
I have a stack which contains some integer data. I want to find out
I have a stack of WCF services installed on a Windows 2008 R2 Standard
I have around 200 jpg images. I need to stack them so that i
I have this script that preloads a stack of images on my index page
I have two grayscale Png files( https://i.stack.imgur.com/8RGh4.jpg ) that I want consider as a
i have a grid view which contain images when click on one image it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.