如何将一个 xaml 页面中的图像值传递到 Windows Phone 7 中的另一个 xaml 页面? [英] How to pass the image value in one xaml page to another xaml page in windows phone 7?

查看:29
本文介绍了如何将一个 xaml 页面中的图像值传递到 Windows Phone 7 中的另一个 xaml 页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的要求是,在第一个 xaml 页面中放置所有图像.如果每当单击特定图像时,该图像可以显示在另一个 xaml 页面中.如何将图像值从一个 xaml 页面传递到另一个 xaml 页面,以便使用 Silverlight 进行 Windows Phone 7 应用程序开发.

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.

推荐答案

DimeCasts.net 在 http://www.dimecasts.net/Casts/CastDetails/174

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

作为执行此操作的一种方法(并假设图像在 ListBox 中)的示例,将以下内容添加到 SelectionChanged 事件.

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}" />

并且原始列表框绑定到 PhotoViewModel 对象的 uri 属性.

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.

这篇关于如何将一个 xaml 页面中的图像值传递到 Windows Phone 7 中的另一个 xaml 页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆