views:

30

answers:

1

Hi, My Requirement is, in first xaml page place all the images .if whenever click on particular image that image can be displayed in another xaml page .How To pass The image value from one xaml page to another xaml page for windows phone 7 app developement using silverlight.

+1  A: 

There's a good screencast on different ways of navigating between pages (and passing values) from DimeCasts.net at http://www.dimecasts.net/Casts/CastDetails/174

As an example of one way of doing this (and assuming the images were in a ListBox) would be to add the following to the SelectionChanged event.

private void OnSelectedImageChanged(object sender, SelectionChangedEventArgs e)
{
  NavigationService.Navigate(new Uri(string.Format("/image/{0}", HttpUtility.UrlEncode(((sender as ListBox).SelectedItem as PhotoViewModel).uri)), UriKind.Relative));
}

The above assumes an appropriately mapped route like:

<nav:UriMapping Uri="/image/{image}" MappedUri="/Image.xaml?u={image}" />

and that the original listbox was bound to the uri property of a PhotoViewModel object.

Hopefully, watching the screencast should make any of the above clearer.

Matt Lacey