views:

39

answers:

1

I am using Silverlight to develop a Windows Phone 7 application. My requirement is when clicking on 1 image then it can be displayed in next page and zoomin that image automatically in that page. In the same way by clicking on another images same approach has to be occur. Give Detail explanation and Code For that One i'm new in windows phone application developer.

A: 

There are several ways to achieve this, but perhaps the simplest way is to use the Navigate method.

When the user clicks on your first image, grab the "id" of that image (or url, or whatever you need to pass to the second page), and add it to the navigation string like this:

NavigationService.Navigate(
  new Uri(string.Format("/MyNewPage.xaml?image={0}",myImageID), UriKind.Relative));

Then on the destination page, you can extract that item from the navigation string in the OnNavigatedTo handler:

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
    myImageID = int.Parse(NavigationContext.QueryString["imageID"]);
}

Like I say, this is a very simplistic approach, and you can implement something much nicer with databinding, but it will do the trick.

Ben Gracewood
Thanks Ben and can u Tell me How To add Media TO an images that can be play whenever user clicks on particular image the related sound can be play in silverlight.
venkateswara reddy
Put a MediaElement on the same page, and call its "Play" method when you click on an image.
Ben Gracewood
Also if you're happy with my answer can you mark it as the accepted answer?
Ben Gracewood