C# Combine String from Json Webrequest before binding Windows Universal

C# Combine String from Json Webrequest before binding Windows Universal

我得到了一个带有包含图像的数据模板的列表框。图像的来源应该是静态 url(等 http://www.google.de/)和我从 Json webrequest 获得的字符串值的组合,它位于根对象的列表中json类。 所以我在我的 Json 类中有字符串值:

  public string icon_url { get; set; }

在我可以绑定到这个之前,我需要为每个项目组合静态 uri 和个人 icon_url。我该怎么做呢?不,我不能在 xaml 中使用多个绑定,它在 windows universal 中不受支持。

在将 ItemsSource 设置为您的列表框之前,您可以执行以下操作

for(int i = 0; i < myList.Count; i++)
   myList[i].icon_url = "my_base_url" + myList[i].icon_url;

之后只需设置 ItemSource