Windows Phone 7 - 来自 URL 的图像颜色叠加

本文关键字:图像 颜色 叠加 URL 来自 Phone Windows | 更新日期: 2023-09-27 18:30:49

在我的Windows Phone 7.1应用程序中,我有一个功能齐全的ListBox,它显示来自Web服务的数据。在ListBox中,我能够使用以下xaml放置图像并将图像源绑定到从 Web 服务返回的值:

<Image Source="{Binding WebImageUrl}" Width="60" Height="60" />

这很好用。但是现在我正在尝试用另一种颜色覆盖图像,为此,我遵循此处发布的SO问题。如果图像明确说明,这也很好用。如果我尝试绑定 url,它不起作用。

例如,代码:

<Rectangle Fill="Red" Width="60" Height="60">
  <Rectangle.OpacityMask>
    <ImageBrush ImageSource="http://someurl.com/repository/images/icon100.png"/>
  </Rectangle.OpacityMask>
</Rectangle>

工程。但是,代码:

<Rectangle Fill="Red" Width="60" Height="60">
  <Rectangle.OpacityMask>
    <ImageBrush ImageSource="{Binding WebImageUrl}"/>
  </Rectangle.OpacityMask>
</Rectangle>

不。代码编译文件,但 Visual Studio 引发分析错误。

有没有办法让ImageBrush.ImageSource绑定到字符串???

任何想法将不胜感激。我已经在这里呆了一段时间,但没有运气。

干杯布雷特

Windows Phone 7 - 来自 URL 的图像颜色叠加

--

已删除 --

您的原始代码对我来说似乎工作正常,带有字符串属性,所以我没有看到任何问题......