Windows Phone 8 图像绑定

编程入门 行业动态 更新时间:2024-10-25 10:22:32
本文介绍了Windows Phone 8 图像绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我想将一个图像 URL 绑定到我的 Windows Phone 8 应用程序中的图像控件,代码如下:

I want to bind an image-url to an image control in my Windows Phone 8 app, here's the code:

<ListBox x:Name="ImageList" SelectionChanged="spotlightListBox_SelectionChanged"  >
   <ListBox.ItemTemplate>
      <DataTemplate>
         <Grid Width="420">
            <StackPanel Height="325" VerticalAlignment="Top">
               <Image x:Name="eventImage" Source="{Binding ImageUrl}" VerticalAlignment="Top"/>
            </StackPanel> 
         </Grid>  
      </DataTemplate>
   </ListBox.ItemTemplate>
</ListBox>

通过这种方式我得到ag_e_network_error".ImageUrl 正在工作,我在不同的页面中使用相同的 URL,它们工作正常.我只在这段代码中得到错误.我不明白错误的原因.ListBox Itemsource 是一个通用列表.

With this way i get "ag_e_network_error". The ImageUrl is working, I use the same URL in different pages and they work fine. I get the error only in this code. I don't understand the reason of the error. ListBox Itemsource is a generic list.

ImageList.ItemsSource = spotlightInfo.Spots;

Spots 对象是一个通用列表.像这样.

Spots object is a genereic list. And Like this.

public string Name { get; set; }
public string Type { get; set; }
public string Text { get; set; }
public string ImageUrl { get; set; }

图片网址如 www.someurl/someImage.jpg

在可能出现问题的地方提供一些帮助将不胜感激.

Some assistance on where there may be an issue would be appreciated.

推荐答案

尝试将 ImageUrl 的类型从字符串更改为 Uri

Try changing the type of ImageUrl from string to Uri

这篇关于Windows Phone 8 图像绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 14:04:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117749.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   图像   Windows   Phone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!