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:
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.
标签:
windows-phone-7