【问题标题】:How to pass the image value in one xaml page to another xaml page in windows phone 7?如何将一个 xaml 页面中的图像值传递给 windows phone 7 中的另一个 xaml 页面?
【发布时间】:2010-12-31 02:08:21
【问题描述】:

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

【问题讨论】:

    标签: windows-phone-7


    【解决方案1】:

    有一个很好的截屏视频,介绍了来自 DimeCasts.net 在页面之间导航(和传递值)的不同方式http://www.dimecasts.net/Casts/CastDetails/174

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

    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));
    }
    

    以上假设一个适当映射的路线,如:

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

    原始列表框绑定到PhotoViewModel 对象的uri 属性。

    希望通过观看截屏视频可以使上述任何内容更加清晰。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-19
      • 1970-01-01
      相关资源
      最近更新 更多